Skip to content

lib-finStackMobile 库参考(第 2 部分) ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793783656/FIN+5.3.1+lib-finStackMobile+part+2 中文整理基于 FIN 5.3.1

导读: projName: context()- projName

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​

  • def
  • finStackMenuAll(target: null)
  • finStackMenuAppList(dict: false)
  • finStackMenuApplySettings(settings, prog, reconstAction, booleans)
  • finStackMenuBackButton(headerDis: "", settings: null, previousApp: "")
  • finStackMenuFolderPath(recsOrFilter, userName, settings: null, folderPath: null)
  • finStackMenuInsertVar(obj, splitStr, menuAction: false)
  • finStackMenuOkForm(title, msg, opts: {})
  • finStackMenuOpenNew(userName, settings, appName, targetRef: null, paginateMax: 25)
  • finStackMobileMenu(curUser: null, targetRef: null, appName: null, settings: null)
  • finSummaryDeleteForm(id, tref: null)
  • finSummaryJson(targetRef: null, summaryRef)
  • finSummaryMenu(targetRef: null)
  • finSyncHisForm(ids, syncFunc)
  • finTraceSubEquip(curEquipRef, query, pointsOnly, returnWhenFound)
  • finUniversalServiceRestart()
  • finValidateEmail(email)
  • finWeatherMenu()
  • findEquipTreeAddOpts(rawNavMetaPath, curNavIndex, curNavStr, recordRef)
  • folderPathDelete(folderPathToRemove, folderInfo: null)
  • folderPathEdit(folderId, newName)
  • folderPathMove(item, newFolderPath, treeTagName: "", emptyFolderId: null)
  • folioDebugQueryForm(col)
  • folioDebugTagForm(col)
  • folioDebugWatchesForm(col)
  • folioFileAddTagForm(id, num, stage: null)
  • folioFileBatchTrashForm(inp)
  • folioFileEditForm(id, col, num)
  • folioFileTrashForm(inp, num)
  • folioFileUploadForm()
  • folioOrphanCleanup(id: null)
  • folioOverwriteFileCommit(fileId, loadedFile)
  • folioOverwriteFileForm(fileId, codeOrWhatever)
  • folioQueryForm(stage: null, ext: "")
  • folioQueryMenu(stage: null)
  • folioQueryViewForm(ext)
  • folioSnapRestoreProgBar(stage: null)
  • folioSnapRestoreRestart()
  • folioSnapUploadForm(stage: null)
  • folioTrashDeleteForm(id)
  • folioTrashEmptyForm()
  • folioTrashRestoreForm(id)
  • folioTrashViewForm(id)
  • getEnumAlarmText(curVal, alarmStateText: "null")
  • graphicsBuilderNew(id, secondId: null, viewAll: false, folderPath: null)
  • graphicsMenu(targetRef, viewAll: false)
  • graphicsMenuSettings(viewAll: false, id: null, target: null)
  • graphicsMobileMenu()
  • graphicsSelectedMenu(id)
  • graphicsVirtPtIcon(item)
  • graphicsVirtPtIconColor(item)
  • infoInfoForm(type)
  • infoLintForm()
  • infoReportForm()
  • infoThreadsForm()
  • infoViewerLibsForm()
  • jobAppConfig()
  • jobCreateForm(id: null, fail: null, folderPath: null, fromDbBuilder: false)
  • jobDebugForm()
  • jobEditForm(id, col, edit: true, ext: null, fromDbBuilder: false, emptyFolderId: null)
  • jobFinBackup()
  • jobParseTime(type, params)
  • jobRunForm(id, par)
  • jobTrashForm(id: null, act: null)
  • manualOverrideArrayMenu(pointId)
  • manualOverrideMenu(targetRef)
  • manualOverridesMainMenu()
  • menuForButton()
  • menuForLabel()
  • menuForProgram()
  • menuForSuperman()
  • menuForVirtualPoint()
  • mobileViewRecordAdd(id, appid, back: null)
  • mobileViewRecordEdit(id, col, appid, back: null)
  • mobileViewRecordInfo(id, appid, back: null)
  • mobileViewRecordString()
  • nextActionProgramBlockTree()
  • nextActionProgramBlockTree2(cat)
  • nextActionProgramTree(id)
  • nextActionProgramTree2(id)
  • priorityBadgeVal(item)
  • scheduleBadgeTip(item)
  • scheduleBadgeType(item)
  • scheduleBadgeVal(item, getOpp: false)
  • scheduleCreateNewCommit(name, type, tz, defVal: null, enum: null, menuDict: null, returnScheduleRec: false)
  • scheduleCreateNewDefVal(name, type, tz, defVals, menuDict)
  • scheduleCreateNewForm(targetRef: null, fromPrevious: false, previousChoice: null, folderPath: null)
  • scheduleDisplay(item, targetRef)
  • scheduleFindPoints(id, type: null, menuDict: null)
  • scheduleFindPointsCommit(pointList, scheduleID, menuDict: null)
  • scheduleGetRefs(targetRef)
  • scheduleIconTip(curSchedule, targetRef: null)
  • scheduleMenu(targetRef, fromShowAll: false)
  • scheduleMenuSettings(targetRef: null, showAll: false, fromForm: false)
  • scheduleMoveSchedulable(oldId, newId)
  • scheduleToolTreeForm(scheduleID)
  • scheduleToolTreeFormCommit(name, id)
  • selectActionDiscover(id: null, connType: "bacnetConn", useConnDiscover: false)
  • selectActionEquipTree(selectedRef: null)
  • selectActionGraphicsTree(folderPath: "")
  • selectActionJobTree(folderPath: "", jobId: null)
  • selectActionProgramCatTree(cat)
  • selectActionProgramCatTree2(name)
  • selectActionProgramTasksTree(id, target)
  • selectActionProgramTree(folderPath: "")
  • selectActionProgramVarBindingsTree(id)
  • selectActionScheduleTree(folderPath: null)
  • selectActionScheduleTree2(schId)
  • selectActionTagBundlesTree(selectedRef: "")
  • userDeleteConfirm(id)
  • userFormSetPassword(properties, optionals)
  • usersAccessFilterWizard(propertyList, choices)
  • usersEditUsernameForm(id, edit: false, data: null)
  • usersFormAppPermissions(id)
  • usersFormAppPermissionsCommit(appList, userId)
  • usersFormClone(id, newInfo: null)
  • usersFormCloneCommit(id, newUsername, newPass, passConfirm, firstName, lastName)
  • …(其余标题见英文正文)

概述(中译) ​

finStackMenuAll(目标: null)

轴突功能


API 正文(英文) ​

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(target:null) => do
  projName: context()->projName
  userName: finGetCurrentUser()->username

  skySparkApps: [
    {
      //KPI
      displayName: toLocale("finStackMobileExt::kpi"),
      link: "",
      appId: "kpi",
      extName: "kpi",
      icon: "icon-lock",
      iconType: "class",
      hasBadge: false,
      action: "window.app.LoadApplication('"+ finCreateEmbeddedLink("kpiUi2View") +"')",
      level: 0,
      ui: "html",
      order: 106,       //System Integrator
      classes:"mobile-hidden"
    },

    {
      displayName: toLocale("finStackMobileExt::siteSpark"),
      link: "",
      appId: "siteSpark",
      extName: "siteSpark",
      icon: "icon-lock",
      iconType: "class",
      rightIcon: "icon-information",
      rightIconType: "class",
      rightIconTooltip: toLocale("finStackExt::information"),
      hasBadge: false,
      action: "window.app.LoadApplication('"+ finCreateEmbeddedLink("siteSparkUi2View") +"')",
      level: 0,
      order: 108,       //System Integrator
      ui: "html",
      classes:"mobile-hidden"
    },

    { //Spark
      displayName: toLocale("finStackMobileExt::spark"),
      link: "",
      appId: "spark",
      extName:"spark",
      icon: "icon-lock",
      iconType: "class",
      hasBadge: false,
      badgeValue: "15",
      badgeType: "normal",
      action: "window.app.LoadApplication('"+ finCreateEmbeddedLink("sparkUi2View") +"')",
      level: 0,
      order: 109,
      ui: "html",
      classes:"mobile-hidden"
    },

    { //Reports
      displayName: toLocale("finStackMobileExt::debugReport"),
      link: "",
      appId: "report",
      extName: "report",
      icon: "icon-star",
      iconType: "class",
      hasBadge: false,
      action: "window.app.LoadApplication('"+ finCreateEmbeddedLink("reportUi2View") +"')",
      level: 0,
      order: 107,       //System Integrator
      ui: "html",
      classes:"mobile-hidden"
    }
  ]

  [
    { //Funcs
      displayName: toLocale("finStackMobileExt::rightMenuFuncs"),
      link: "",
      appId: "funcs",
      icon: "icon-code",
      iconType: "class",
      hasBadge: true,
      badgeValue: secureReadAll(func).size,
      badgeType: "normal",
      badgeTooltip: toLocale("finStackMobileExt::numFunctions"),
      action: "window.location.href = window.location.origin + window.location.pathname + '#' + (app.CurrentAppName() === \"trendList\" ? app.APP_NAMES.HISTORIAN : app.CurrentAppName()) + '?lhs=funcs' + (\"{{targetRef}}\" !== \"null\" ? '&targetRef={{targetRef}}' : '')",
      level: 0,
      order: 202,       //Advanced
      ui: "html",
      classes:"tablet-only-hidden mobile-hidden",
    },

    { //Graphics
      displayName: toLocale("finStackExt::rightMenuGraphicsTitle"),
      link: "#graphics",
      appId: "graphics",
      extName: "finBuilder",
      icon: "icon-direction",
      iconType: "class",
      hasBadge: false,
      action: "window.app.NavigateToApp(app.APP_NAMES.GRAPHICS)",
      level: 0,
      ui: "html",
      order: 3       //End User
    },

    { //Historian
      displayName: toLocale("finStackMobileExt::rightMenuHistorianTitle"),
      link: "#trends",
      action: "window.app.NavigateToApp(app.APP_NAMES.HISTORIAN)",
      appId: "trends",
      extName: "his",
      icon: "icon-graph-bar",
      iconType: "class",
      hasBadge: false,
      level: 0,
      ui: "html",
      order: 4       //End User
    },
    { //Notes
      displayName: toLocale("finStackMobileExt::rightMenuNotesTitle"),
      link: "#notes",
      appId: "notes",
      extName: "note",
      icon: "icon-message",
      iconType: "class",
      hasBadge: false,
      action: "",
      level: 0,
      action: "window.app.NavigateToApp(app.APP_NAMES.NOTES)",
      ui: "html",
      order: 5,       //End User
    },

    { //Point Graphics
      displayName: toLocale("finStackMobileExt::rightMenuPointGraphicsTitle"),
      link: "#points",
      action: "window.app.NavigateToApp(app.APP_NAMES.POINTS)",
      appId: "points",
      extName: "point",
      icon: "icon-location",
      iconType: "class",
      hasBadge: false,
      level: 0,
      ui: "html",
      order: 8       //End User
    },

    { //Summary
      displayName: toLocale("finStackExt::rightMenuSummaryTitle"),
      link: "#summary",
      action: "window.app.NavigateToApp(app.APP_NAMES.SUMMARY)",
      appId: "summary",
      icon: "icon-view-list",
      iconType: "class",
      hasBadge: true,
      badgeValue: readCount(summaryOn), //update to be dynamic?
      badgeType: "normal",
      level: 0,
      ui: "html",
      order: 10       //End User
    },

    { //Advanced Header
      displayName: toLocale("finStackMobileExt::rightMenuAdvanced"),
      appId: "",
      action: "",
      level: 0,
      order: 200,
      ui:"html",
      isDivider:true
    },

    { //End USer Header
      displayName: toLocale("finStackMobileExt::rightMenuEndUserTitle"),
      appId: "",
      level: 0,
      order: 0,
      ui:"html",
      isDivider:true
    },

    { //System Integrator Header
      displayName: toLocale("finStackMobileExt::rightMenuSysIntegrator"),
      order: 100,
      appId: "",
      ui:"html",
      isDivider:true
    }
  ].addAll(skySparkApps)
end


def ​

func:finStackMenuAppList ​

finStackMenuAppList(dict: false) ​

Axon function


meta ​

deffunc:finStackMenuAppList
isfunc
liblib:finStackMobile
namefinStackMenuAppList
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(dict:false) => do
  listOfExts: funcs().finGridFilter(finStackMobileMenu) //all funcs tagged finStackMobileMenu
  listOfWeb: secureReadAll(finWebApp and finStackMobileMenu) //all webAppps tagged finStackMobileMenu
  listOfApps: listOfExts.addRows(listOfWeb)
  appIds: []
  allExts: exts2().colToList("name")

  listOfApps.each app => do
    eval(app->name + "()").findAll(v => not v.has("extName") or allExts.contains(v->extName)).each appDict => do
      if((not appDict.has("isDivider") or not appDict->isDivider) and appDict->appId != "logout")
        if(not dict) appIds = appIds.add(appDict->appId)
        else appIds = appIds.add({appId: appDict->appId, appName: appDict->displayName})
    end
  end

  if(dict) appIds.toGrid.unique("appId").toRecList
  else appIds.unique
end


def ​

func:finStackMenuApplySettings ​

finStackMenuApplySettings(settings, prog, reconstAction, booleans) ​

Axon function


meta ​

deffunc:finStackMenuApplySettings
isfunc
liblib:finStackMobile
namefinStackMenuApplySettings
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(settings, prog, reconstAction, booleans) => do
  enableLink: booleans->link
  enableAction: booleans->action
  evalOnly: booleans->eval
  menuAction: booleans->menu

  prog = prog.findAll(x=> if(x.isNumber) if(x.toStr=="NaN") false else true else true)

  {
    displayName: if(settings.has("display") and prog.has(settings->display)) //may be able to remove
                   prog[settings->display]
                 else if(settings.has("displayFunc"))
                   eval(prog.toAxonCode + "." + settings->displayFunc)
                 else if(not prog.has("displayName"))
                   prog.dis
                 else
                   prog->displayName,

    appId: if(settings.has("appId")) prog[settings->appId]
           else if(prog.has("apId")) prog->appId
           else "",

    link: if(enableLink) reconstAction
            else if(settings.has("link")) prog[settings->link]
            else if(prog.has("link")) prog->link
            else "",

    action: if(not enableAction) do
              if(settings.has("action")) reconstAction
              else if(prog.has("action")) prog->action
              else ""
            end else if(menuAction) "window.app.ObtainMenu(" + reconstAction + ")"
            else if(evalOnly) "finstack.eval(" + reconstAction.toAxonCode.replace("'", "\\\"").replace("\$", "\\\\\$") + ")" //"finstack.eval(" + prog.toAxonCode + "." + reconstAction.toAxonCode + ")"
            else "window.app.LoadApplication(" + reconstAction.toAxonCode + ")",

    order: if(settings.has("order")) //do
             settings->order
           else if(settings.has("orderFunc"))
             eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->orderFunc).replace("'", "\""))
           else if(prog.has("order")) prog->order
           else 99,

    level: if(settings.has("level")) //do
               settings->level
             else if(settings.has("levelFunc"))
               eval(prog.toAxonCode + "." + settings->levelFunc)
             else if(prog.has("level")) prog->level
             else 0,

    iconType: if(settings.has("iconType")) prog.finStackMenuInsertVar(settings->iconType)
              else if(settings.has("iconTypeFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->iconTypeFunc).replace("'", "\""))
              else if(prog.has("iconType")) prog.finStackMenuInsertVar(prog->iconType)
              else "class",

    icon: if(settings.has("icon")) prog.finStackMenuInsertVar(settings->icon)
          else if(settings.has("iconFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->iconFunc).replace("'", "\""))
          else if(prog.has("icon")) prog.finStackMenuInsertVar(prog->icon)
          else "",

    iconTooltip: if(settings.has("iconTooltip")) prog.finStackMenuInsertVar(settings->iconTooltip)
                 else if(settings.has("iconTooltipFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->iconTooltipFunc).replace("'", "\""))
                 else if(prog.has("iconTooltip")) prog.finStackMenuInsertVar(prog->iconTooltip)
                 else "",

    iconClass: if(settings.has("iconClass")) prog.finStackMenuInsertVar(settings->iconClass)
               else if(settings.has("iconClassFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->iconClassFunc).replace("'", "\""))
               else if(prog.has("iconClass")) prog.finStackMenuInsertVar(prog->iconClass)
               else "",

    rightIcon: if(settings.has("rightIconFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->rightIconFunc).replace("'", "\""))
               else if(settings.has("rightIcon")) prog.finStackMenuInsertVar(settings->rightIcon)
               else if(prog.has("rightIcon")) prog.finStackMenuInsertVar(prog->rightIcon)
               else "",

    rightIconType: if(settings.has("rightIconType")) prog.finStackMenuInsertVar(settings->rightIconType)
                   else if(settings.has("rightIconTypeFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->rightIconTypeFunc).replace("'", "\""))
                   else if(prog.has("rightIconType")) prog.finStackMenuInsertVar(prog->rightIconType)
                   else "class",

    rightIconTooltip: if(settings.has("rightIconTooltip")) prog.finStackMenuInsertVar(settings->rightIconTooltip)
                      else if(settings.has("rightIconTooltipFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->rightIconTooltipFunc).replace("'", "\""))
                      else if(prog.has("rightIconTooltip")) prog.finStackMenuInsertVar(prog->rightIconTooltip)
                      else "",

    keepOpen: if(settings.has("keepOpen")) settings->keepOpen
              else if(settings.has("keepOpenFunc")) eval(prog.toAxonCode + "." + settings->keepOpenFunc)
              else if(prog.has("keepOpen")) prog->keepOpen
              else false,

    hasBadge: if(settings.has("hasBadge")) settings->hasBadge
              else if(settings.has("hasBadgeFunc")) eval(prog.toAxonCode + "." + settings->hasBadgeFunc)
              else if(prog.has("hasBadge")) prog->hasBadge
              else false,

    badgeTooltip: if(settings.has("badgeTooltipFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->badgeTooltipFunc).replace("'", "\""))
                  else if(settings.has("badgeTooltip")) prog.finStackMenuInsertVar(settings->badgeTooltip)
                  else if(prog.has("badgeTooltip")) prog.finStackMenuInsertVar(prog->badgeTooltip)
                  else "",

    badgeValue: if(settings.has("badgeValueFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->badgeValueFunc).replace("'", "\""))////////////template for rest
                else if(settings.has("badgeValue")) prog.finStackMenuInsertVar(settings->badgeValue)
                else if(prog.has("badgeValue")) prog.finStackMenuInsertVar(prog->badgeValue)
                else "0",

    badgeType: if(settings.has("badgeTypeFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->badgeTypeFunc).replace("'", "\""))
               else if(settings.has("badgeType")) prog.finStackMenuInsertVar(settings->badgeType)
               else if(prog.has("badgeType")) prog.finStackMenuInsertVar(prog->badgeType)
               else "normal",

    progressbar: if(settings.has("progressbar"))
                   settings->progressbar
                 else if(settings.has("progressbarFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->progressbarFunc).replace("'", "\""))
                 else if(prog.has("progressbar"))
                   prog->progressbar
                 else if(prog.has("progressbarFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(prog->progressbarFunc).replace("'", "\""))
                 else "",

    submenu: if(settings.has("submenu"))
               settings->submenu
             else if(settings.has("submenuFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->submenuFunc).replace("'", "\""))
             else if(prog.has("submenu"))
               prog->submenu
             else if(prog.has("submenuFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(prog->submenuFunc).replace("'", "\""))
             else "",

    classes: if(settings.has("classes"))
               settings->classes
             else if(settings.has("classesFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(settings->classesFunc).replace("'", "\""))
             else if(prog.has("classes"))
               prog->classes
             else if(prog.has("classesFunc")) eval(prog.toAxonCode + "." + prog.finStackMenuInsertVar(prog->classesFunc).replace("'", "\""))
             else "",
  }
end


def ​

func:finStackMenuBackButton ​

finStackMenuBackButton(headerDis: "", settings: null, previousApp: "") ​

Axon function


meta ​

deffunc:finStackMenuBackButton
isfunc
liblib:finStackMobile
namefinStackMenuBackButton
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(headerDis: "", settings: null, previousApp: "") => do
  [{
    displayName: toLocale("finStackExt::back"),
    link: "",
    appId: "",
    icon: "icon-return",
    iconType: "class",
    keepOpen:true,
    action: "window.app.ObtainMenu(null, null, '" + previousApp + "', " + settings.toAxonCode + ")",
    order: -1100,
    level: 0,
    ignoreSettings: marker(),
    folderPath: ""
  },

  {
    displayName: headerDis,
    appId: "",
    action: "",
    level: 0,
    order: -1000,
    isDivider:true,
    ignoreSettings: marker(),
    folderPath: "",
    header
  }]
end


def ​

func:finStackMenuFolderPath ​

finStackMenuFolderPath(recsOrFilter, userName, settings: null, folderPath: null) ​

Axon function


meta ​

deffunc:finStackMenuFolderPath
isfunc
liblib:finStackMobile
namefinStackMenuFolderPath
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(recsOrFilter, userName, settings: null, folderPath: null) => do //, settings
  menuItems: null
  backFolderPath: ""
  appName: settings->appName

  menuMeta: try recsOrFilter.meta catch {}
  try recsOrFilter = recsOrFilter.toRecList catch null

  if(recsOrFilter.isList() and folderPath != null) do
    numLevels: folderPath.split("/")
    keepGoing: true

    //recsOrFilter.toGrid.sort("folderPath").ioWriteTrio(`io/LOOKATME.trio`)

    each(numLevels) (x, i) => do
      if(recsOrFilter.findAll(v => v->folderPath == numLevels[0..(-2 - i)].concat("/") or v->folderPath == ("/" + numLevels[0..(-2 - i)].concat("/"))).size > 0 and (folderPath.split("/")[0..(-1 - i)].size > 1) and keepGoing) do
        backFolderPath = folderPath.split("/")[0..(-2 - i)].concat("/") // + "+" + appName
        keepGoing = false
      end
    end

    menuItems = recsOrFilter.findAll(v => (v.has("isHeader") and v->isHeader) or v.has("header") or v->displayName == toLocale("finStackExt::back") or (v.has("folderPath") and (v->folderPath.replace("/ ", "/").replace(" /", "/") == folderPath.replace("/ ", "/").replace(" /", "/")
      or v->folderPath.replace("/ ", "/").replace(" /", "/") == "/" + folderPath.replace("/ ", "/").replace(" /", "/") or v->folderPath.replace("/ ", "/").replace(" /", "/") == folderPath.replace("/ ", "/").replace(" /", "/") + "/"
      or v->folderPath.replace("/ ", "/").replace(" /", "/") == "/" + folderPath.replace("/ ", "/").replace(" /", "/") + "/" or v->folderPath.replace("/ ", "/").replace(" /", "/").startsWith(folderPath + "/")
      or v->folderPath.replace("/ ", "/").replace(" /", "/").startsWith("/" + folderPath + "/"))))
      //echo("curPath: " + folderPath)

    menuItems = menuItems.map(row => do
      if(row->displayName == toLocale("finStackExt::back")) row.set("action", "window.app.ObtainMenu(" + userName.toAxonCode + ", null, " + appName.toAxonCode + ", " + settings.set("curPage", 0).set("folderPath", backFolderPath).toAxonCode + ")")
      else if(row.has("header")) row.set("displayName", folderPath.split("/")[-1])
      else row
    end)

    if(menuItems.find(v=> v->displayName == toLocale("finStackExt::back")) == null )menuItems = finStackMenuBackButton(folderPath, settings.set("curPage", 0).set("folderPath", backFolderPath), appName).addAll(menuItems.findAll(v=> not v.has("header")))
  end

  try menuItems = menuItems.toGrid.addMeta(menuMeta) catch null
  if(settings.has("folderPathCount"))
    menuItems.finStackMenuNavFolderPath(userName, settings, folderPath, settings->folderPathCount)
  else
    menuItems.finStackMenuNavFolderPath(userName, settings, folderPath)
end


def ​

func:finStackMenuInsertVar ​

finStackMenuInsertVar(obj, splitStr, menuAction: false) ​

Axon function


meta ​

deffunc:finStackMenuInsertVar
isfunc
liblib:finStackMobile
namefinStackMenuInsertVar
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(obj, splitStr, menuAction:false) => do
  reconstStr: ""

  if(splitStr.isStr or splitStr.isList) do
    if(not splitStr.isList)do
      splitStr = splitStr.replace("{", "*~").replace("}", "*").split("*")
    end

    splitStr.each x => do
      if(x.contains("~")) do
        if(x.replace("~", "").trim() == "project")
          reconstStr = reconstStr + settings->project
        else do
          if(not menuAction) reconstStr = reconstStr + obj[x.replace("~", "").trim]
          else reconstStr = reconstStr + obj[x.replace("~", "").trim]
      end else reconstStr = reconstStr + x
    end

    return reconstStr.replace("'+'", " ")
  end else return splitStr
end


def ​

func:finStackMenuOkForm ​

finStackMenuOkForm(title, msg, opts: {}) ​

Axon function


meta ​

deffunc:finStackMenuOkForm
isfunc
liblib:finStackMobile
namefinStackMenuOkForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(title, msg, opts: {}) => do
  if(opts.isDict) do
    axonAction: if(opts["commitAction"] != null) opts->commitAction else ""
    includeCancel: if(opts["includeCancel"] != null) opts->includeCancel else false
    confirmButton: if(opts["commitButton"] != null) opts->commitButton else toLocale("finStackExt::ok")
    cancelButton: if(opts["cancelButton"] != null) opts->cancelButton else toLocale("finStackExt::cancel")
    jsAction: if(opts["completeAction"] != null) opts->completeAction else ""

    if(opts.has("itemId")) jsAction = jsAction.replace("{item}", if(opts.isDict) opts->itemId.toAxonCode else opts->itemId[0].toAxonCode)
  end else do
    axonAction: ""
    includeCancel: false
    confirmButton: toLocale("finStackExt::ok")
    cancelButton: toLocale("finStackExt::cancel")
    jsAction: opts
  end

  body: [
    {
      name:"label",
      editorType: "label",
      text: msg
    },

    {
      name:"commitButton",
      editorType:"button",
      label:confirmButton,
      controlBar:true
    }
  ]

  if(includeCancel) body = body.insert(1, { name: "cancelButton", editorType: "button", label: cancelButton, controlBar: true })

  { "dis": title,
    "name":"mobileOkForm",
    "body":body.toJSON,
    "width": 450,
    "cancelButton": "\$cancelButton",
    "commitButton":"\$commitButton",
    "commitAction": axonAction,
    "completeAction": jsAction,
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finStackMenuOpenNew ​

finStackMenuOpenNew(userName, settings, appName, targetRef: null, paginateMax: 25) ​

Axon function


meta ​

deffunc:finStackMenuOpenNew
isfunc
liblib:finStackMobile
namefinStackMenuOpenNew
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(userName, settings, appName, targetRef:null, paginateMax: 25) => do //, settings
  replaceTarget: (appDict) => do
    cols: appDict.names

    cols.each x => do
      if(appDict[x].isStr) appDict = appDict.set(x, appDict[x].replace("{{targetRef}}", targetRef.toAxonCode))
    end

    return appDict
  end

  //echo(settings.has("funcCall") and not settings.has("filterFor"))
  if(appName != "" and not settings.has("funcCall") and not settings.has("filterFor")) do
    if(appName == "schedules") settings = settings.merge(replaceTarget(scheduleMenuSettings(targetRef)))
    else if(appName == "graphicsBuilder") settings = settings.merge(replaceTarget(graphicsMenuSettings(false, null, targetRef)))
    else if(appName == "folio") settings = settings.merge(replaceTarget(finFolioSettings("forMenu2")))
    else if(appName == "jobs") settings = settings.merge(replaceTarget(finJobSettings("forMenu2")))
    else if(appName == "connectors") settings = settings.merge(replaceTarget(connectorsMenuSettings()))
    else if(appName == "summBuilder") settings = settings.merge(replaceTarget({ header: toLocale("finStackExt::summaries"), funcCall: "finSummaryListMenu({{targetRef}})", display: "dis" }))
    else if(appName == "projects" ) settings = settings.merge(replaceTarget({ funcCall: "finHostMenu("+userName.toAxonCode+")", header: toLocale("finStackMobileExt::hostFinHost") }))
    else do
      try settings = settings.merge(replaceTarget(eval(appName+"MenuSettings("+targetRef.toAxonCode+")")))
      catch ""
    end
  end

  if(not settings.has("project"))
    settings = settings.set("project", context()->projName)
  if(not settings.has("inPage"))
    settings = settings.set("inPage",false)
  if(not settings.has("folderPath"))
    settings = settings.set("folderPath", "")

  //firstLevel
  menuItems: if(settings.has("funcCall"))
              eval(settings->funcCall.replace("'", "\"").replace("{{targetRef}}", null))
            else eval("secureReadAll(" + settings->filterFor + ")")
  menuMeta: try menuItems.meta catch {}
  tempHolder: null
  folderPath: settings->folderPath
  paginated: false
  menuList: []

  /*if(menuItems.size > paginateMax) do
    menuItems = menuItems.finPaginate(1, paginateMax)
    paginated = true
  end*/

  if(targetRef != null)
    menuItems = menuItems.map(row => row.set("targetId", targetRef))

  //if(not settings.has("hideBackButton") or not settings->hideBackButton) do
  if(settings.has("hideBackButton") and not settings->hideBackButton) do
    menuList = [
      {
        displayName: toLocale("finStackExt::back"),
        link: "",
        appId: "",
        icon: "icon-return",
        iconType: "class",
        keepOpen:true,
        action: "window.app.ObtainMenu('" + userName +"', '{{targetRef}}', null, null)",
        order: -1100,
        level: 0,
        folderPath: ""
      },

      {
        displayName: if(settings.has("header")) settings->header else if (settings.has("headerFunc")) eval(settings->headerFunc) else "",
        link: "",
        appId: "",
        level: 0,
        order: -1000,
        isDivider:true,
        folderPath: "",
        header
      }
    ]
  end

  splitAction: []
  enableAction: false
  enableLink: false
  evalOnly: false
  tempSettings: null
  menuAction: false

  if(settings.has("action") and settings->action != "") do
    if(settings->action.startsWith("func:")) do
      tempSettings = settings.set("action", settings->action[5..-1])
      evalOnly = true
      enableAction = true
    else if(settings->action.startsWith("openMenu:")) do
      tempSettings = settings.set("action", settings->action[9..-1])
      menuAction = true
      enableAction = true
    end else if(settings->action.startsWith("openApp:")) do
      tempSettings = settings.set("action", settings->action[8..-1])
      enableAction = true
    end else
      tempSettings = settings

    if(not menuAction) splitAction = tempSettings->action.replace("{", "*~").replace("}", "*").split("*")
    else splitAction = tempSettings->action.split("*")

  end else if(settings.has("link") and settings->link != "") do
    splitAction = settings->link.replace("{", "*~").replace("}", "*").replace("'", "\"").split("*")
    enableLink = true
  end else if(settings.has("linkFunc") and settings->linkFunc != "") do
    splitAction = settings->linkFunc.replace("{", "*~").replace("}", "*").replace("'", "\"").split("*")
    enableLink = true
  end

  menuItems.each((prog, i) =>
  do
    if(not prog.has("ignoreSettings")) do
      reconstAction: ""

      splitAction.each x => do
        if(x.contains("~")) do
          if(x.replace("~", "").trim() == "project")
            reconstAction = reconstAction + settings->project
          else do
            if(not menuAction) reconstAction = reconstAction + prog[x.replace("~", "").trim]
            else reconstAction = reconstAction + prog[x.replace("~", "").trim]
          end
        end else reconstAction = reconstAction + x
      end

      tempHolder = prog.merge(finStackMenuApplySettings(settings, prog, reconstAction, {link: enableLink, action: enableAction, eval: evalOnly, menu: menuAction}))
    end else
      tempHolder = prog

    if(prog.has("folderPath"))
      tempHolder = tempHolder.merge({folderPath: prog->folderPath})
    else
      tempHolder = tempHolder.merge({folderPath: ""})

    menuList = menuList.add(tempHolder)
  end)

  settings = settings.set("appName", appName)

  if(not settings.has("curPage")) settings = settings.set("curPage", 0)

  try menuList = menuList.toGrid.addMeta(menuMeta) catch null

  if(folderPath == null or folderPath == "") do
    if(settings.has("folderPathCount")) menuList = menuList.finStackMenuNavFolderPath(userName, settings, null, settings->folderPathCount)
    else menuList = menuList.finStackMenuNavFolderPath(userName, settings)
  end else do
    menuList = menuList.finStackMenuFolderPath(userName, settings, folderPath)
  end

  // add ids to each item
  menuList.map((item, i) =>
  do
    itemId: null

    if (item.has("id"))
      itemId = item->id
    //else if (item->displayName.isRef)
      //itemId = item->displayName
    else
    do
      itemId = "menuItem:"+appName+":"

      if (item->displayName.isStr and not item->displayName.isEmpty)
      do
        if (menuList.findAll(v => v->displayName.isStr and not v->displayName.isEmpty and v->displayName.toTagName == item->displayName.toTagName).size == 1)
          itemId = parseRef(itemId + item->displayName.toTagName)
        else
          itemId = parseRef(itemId + item->displayName.toTagName + i.toStr)
      end
      else
        itemId = parseRef(itemId + i.toStr)
    end

    item.merge({itemId: itemId})
  end)
end


def ​

func:finStackMobileMenu ​

finStackMobileMenu(curUser: null, targetRef: null, appName: null, settings: null) ​

Axon function


meta ​

deffunc:finStackMobileMenu
isfunc
liblib:finStackMobile
namefinStackMobileMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(curUser:null,targetRef:null,appName:null,settings:null) => do
  unMadeApps: ["equip", "graphics", "points", "alarms", "notes", "summary", "tools", "trends", "generic", "reports"]

  curUser = userCur()

  if(appName == null or (unMadeApps.contains(appName) and not (settings.has("funcCall") or settings.has("filterFor"))))
  do
    listOfFuncs: funcs().finGridFilter(finStackMobileMenu)      //all funcs tagged finStackMobileMenu
    listOfWeb: secureReadAll(finWebApp and finStackMobileMenu)  //all webAppps tagged finStackMobileMenu
    listOfApps: listOfFuncs.addRows(listOfWeb)

    enabledExts: exts2().finGridFilter(enabled)
    allExts: exts2().colToList("name")
    currentList: null
    appsToDisplay: []
    appPermissions: null
    isDesktop: false

    if(curUser->username == "su") curUser = null

    if(curUser != null) do
      //filter out finApps
      if(curUser.has("finAppAccess")) do
        appPermissions = curUser->finAppAccess.split(",").map r=> r.trim

        if(not curUser.has("mobileAppSet"))
          appPermissions = appPermissions.addAll(finStackMenuDefaultApps())

        appPermissions = appPermissions.map(r => try finStackMenuStaticAppKey().find(v => v->fin == r)->mobile catch r)
      end

      //filter out core apps
      if(curUser.has("appAccess")) do
        if(appPermissions == null) appPermissions = []

        xapps: curUser->appAccess.split(",").map(r =>
        do
          r = r.trim
          try finStackMenuStaticAppKey().find(v => v->norm == r)->mobile
          catch r
        end)

        xapps.each app =>
          if(not appPermissions.contains(app))
            appPermissions = appPermissions.add(app)
      end
    end

    //detect mobile settings
    if(settings != null and not settings->isMobile) isDesktop = true

    /* Go through the list of apps and web apps and filter for those with
    * user permission and are enabled.
    */
    listOfApps.each ext => do
      if(not ext.has("finWebApp")) do //if its "normal" function
        try
          currentList = eval(ext->name + "(" + targetRef + ")").findAll(v => not v.has("extName") or enabledExts.colToList("name").contains(v->extName)) //call the function
        catch (err)
        do
          currentList = []
          logDebug("finStackMobileMenu", "Mobile menu error calling "+ext->name+":", err)
        end

        currentList.each currentMenu => do //go through the list of apps returned by the function
          try do
            if(allExts.contains(currentMenu->appId)) do
              if(enabledExts.find(v => v->name == currentMenu->appId) != null and (appPermissions == null or appPermissions.find(v => v == currentMenu->appId) != null)) do
                if((not isDesktop and currentMenu->ui != "flash") or isDesktop)
                  appsToDisplay = appsToDisplay.add(currentMenu)
              end
            end
            else if(appPermissions == null or appPermissions.find(v => v == currentMenu->appId) != null or currentMenu->appId == "logout" or (currentMenu.has("isDivider") and currentMenu->isDivider and (currentMenu["appId"] == null or currentMenu->appId.isEmpty))) do
              if((not isDesktop and (not currentMenu.has("ui") or currentMenu->ui != "flash")) or isDesktop) appsToDisplay = appsToDisplay.add(currentMenu)
            end //else echo(currentMenu->displayName)
          end catch ""
        end //end loop

      end else if(appPermissions == null or appPermissions.find(v => v == ext->name) != null) do //its a web app and user has permissions
          appsToDisplay = appsToDisplay.add({displayName: ext->dis, level: 0, link: ext->uri, appId: ext->name, icon: ext->icon, iconType: "class", hasBadge: false, badgeValue: "0", badgeType: "normal", action:"", ui: "html"})
      end
    end

    if(appsToDisplay.findAll(v => v.has("order") and v->order > 100 and v->order < 200).isEmpty) appsToDisplay = appsToDisplay.findAll(v => v->displayName != toLocale("finStackMobileExt::rightMenuSysIntegrator"))
    if(appsToDisplay.findAll(v => v.has("order") and v->order > 200).isEmpty) appsToDisplay = appsToDisplay.findAll(v => v->displayName != toLocale("finStackMobileExt::rightMenuAdvanced"))

    return appsToDisplay.toGrid.map(row => if(not row.has("order")) row.set("order", 15) else row).sort("order").sort((a, b) => if(a->order == b->order) a->displayName <=> b->displayName else 0)//"order")
  end else
    finStackMenuOpenNew(curUser->username, settings, appName, targetRef)

end


def ​

func:finSummaryDeleteForm ​

finSummaryDeleteForm(id, tref: null) ​

Axon function


meta ​

deffunc:finSummaryDeleteForm
isfunc
liblib:finStackMobile
namefinSummaryDeleteForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, tref: null) => do
  id = readById(id)
  thisSettings: {
    header: toLocale("finStackExt::summaries"),
    funcCall: "finSummaryListMenu("+ tref.toAxonCode +")",
    display: "dis" }

  body: [
  {name: "label", editorType: "label", text: toLocale("finStackExt::folioFilesDeleteMsg").replace("{0}",id.dis)},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::no"), controlBar: true},
  {name: "commitButton", editorType: "button", label: toLocale("finStackExt::yes"), controlBar: true}
  ]

  {"dis": toLocale("finStackExt::delete")+": "+id.dis,
  "name": "finSummaryDeleteForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$commitButton",
  "commitAction": "finSoftDelete(@"+id->id+")",
  "completeAction": "window.app.ObtainMenu(null, 'null','summary', " + thisSettings.toAxonCode + ")",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finSummaryJson ​

finSummaryJson(targetRef: null, summaryRef) ​

returns a JSON object.

both filters should be entered as strings


meta ​

deffunc:finSummaryJson
isfunc
liblib:finStackMobile
namefinSummaryJson
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef: null, summaryRef) => do
  summary: readById(summaryRef)
  equipList: if(targetRef != null) readAll(summary->equipFilter.replace("\$self", targetRef.toAxonCode).parseFilter)
             else  readAll(summary->equipFilter.replace("==\$self","").replace("==\$self","").replace("== \$self","").parseFilter)
  pointList: []
  rows: []

  columns: [{
    property: "equipDis",
    displayName: "Name",
    type: "Str",
    columnType: "normal",
    poll: false,
    showStatus: false,
    showActions: false,
    enabled: true,
    icon:"icon-gear",
    button: true
  }]

  //build point list
  equipList.each equip =>
    pointList = pointList.addAll(readAll(parseFilter("(" + summary->pointFilter + ") and equipRef == " + equip->id.toAxonCode)).toRecList)

    if(summary.has("pointOrder")) do
      orderList: summary->pointOrder.split(",")

      pointList = pointList.map(r => do
        orderNum: orderList.index(r->navName)

        if(orderNum != null)
          r.set("orderNum", orderNum)
        else
          r.set("orderNum", orderList.size)
      end).toGrid.sort("orderNum")
    end

  //add cols
  if(not pointList.isEmpty) do
    pointList = pointList.map r => if(not r.has("navName")) try r.set("navName", r.dis) catch r.set("navName", "") else r

    pointList.toGrid.unique("navName").each point => do
      thisColType: "normal"
      coldOrHot: ""
      type: if(point.has("sp")) "sp" else if(point.has("sensor")) "sensor" else if(point.has("cmd")) "cmd" else null

      if((point->kind == "Number" and (point.has("unit") and point->unit == "%")) or point.has("showGauge")) do
        thisColType = "gauge"

        if(point.has("cold") or point.has("cool") or point.has("chiller") or point.has("chilled") or point.has("cooling"))
          coldOrHot = "cold"
        else if(point.has("hot") or point.has("heat") or point.has("heating") or point.has("heated") or point.has("boiler"))
          coldOrHot = "hot"
      end

      tempCol: {
          property: point->id.toStr,
          displayName: point->navName,
          type: point->kind,
          columnType: thisColType,
          format: null,
          ratingIcon: null,
          poll:true,
          showStatus: true,
          showActions: true,
          enabled: true,
          allowPolling: true,
          pointType: type,
          unit: try point->unit catch null,
          activity: coldOrHot
      }

      if(thisColType == "gauge")
        tempCol = tempCol.set("min", 0).set("max", 100)

      //if number check if format should be set
      if(point->kind == "Number") do

        //if has curValFormat add that as the format
        if(point.has("curValFormat"))
          tempCol = tempCol.set("format", point->curValFormat)

        //else if point has precision and a unit, set format to match precision
        else if(point.has("precision") and point.has("unit")) do
          newFormat: "0,0"

          if(point->precision > 0) do
            newFormat = newFormat + "."
            (1..(point->precision)).each x => newFormat = newFormat + "0"
          end

          tempCol = tempCol.set("format", newFormat)
        end
      end

      //if kindis bool add enum property
      else if(point->kind == "Bool")
        try tempCol = tempCol.set("enum", point->enum)
        catch tempCol = tempCol.set("enum","False,True")

      columns = columns.add(tempCol)
    end //end all cols
  end//end if not empty

  equipList.each equip => do
    tval: if(summary.has("equipDisMacro")) equip.finMacro(summary->equipDisMacro) else equip.dis
    if(equip.has("description")) tval = tval + "<br>" + equip->description
    tempRow: {equipDis: {val: tval, id: "@" + equip->id.toStr}} //add equipName to row

    columns.each col => do
      if(col->property != "equipDis") do
        curPoint: pointList.find(v => v->navName == col->displayName and v->equipRef == equip->id)

        tempRowCol: {
          val: if(col->type == "Number") null else "",
          id: "",
          actions: false,
          status: ""
        }

        if(curPoint != null) do //if equip has the point, add the point to the row
          tempRowCol = curPoint.merge({
            val: try if(curPoint->kind == "Number" and curPoint->curVal == nan()) null else curPoint->curVal catch "",
            id: "@" + curPoint->id.toStr,
            actions: if(curPoint.has("actions")) true else false,
            status: try curPoint->curStatus catch ""
          })
        end

        tempRow = tempRow.set(col->property, tempRowCol)
      end
    end//col loop

    rows = rows.add(tempRow)
  end

  title: try readById(targetRef).dis + " - " catch ""

  data: {displayName: title + summary.dis, columns: columns, rows: rows}

  return data.toJSON()
end


def ​

func:finSummaryMenu ​

finSummaryMenu(targetRef: null) ​

Axon function


meta ​

deffunc:finSummaryMenu
finStackMobileMenu✓
isfunc
liblib:finStackMobile
namefinSummaryMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef:null) => do
  settings: {
    funcCall: "finSummaryListMenu({{targetRef}})",
    display: "dis",
    hideBackButton: true
  }

  summBuildSub: {
    startOpen: false,
    items: [
      {
        label: toLocale("finStackMobileExt::bLineNew"),
        icon: "icon-document-new",
        tooltip: toLocale("finStackExt::createSum")+".",
        action: "finstack.eval('finFormCreateSummary({{targetRef}})')",
        keepOpen: true
      },
      {
        label: toLocale("finStackExt::summaries"),
        icon: "icon-view-list",
        tooltip: toLocale("finStackMobileExt::viewSummaries"),
        action: "window.app.ObtainMenu(null, 'null', 'summBuilderApp', "+ settings.toAxonCode +")",
        keepOpen: true
      }
    ]
  }.toJSON()

  try do
    if(targetRef==null) summCount: readCount(summaryOn)
    else summCount: readAll(summaryOn).findAll(x=> toGrid([targetRef.readById]).finGridFilter(parseFilter(x->summaryOn)).size > 0).size
  end catch summCount: 0

  [
    {
      displayName: toLocale("finStackMobileExt::rightMenuSummaryBuilder"),
      appId: "summBuilderApp",
      icon: "icon-checklist",
      iconType: "class",
      level: 0,
      ui: "html",
      action: "null",
      order: 105,
      keepOpen: true,
      submenu: summBuildSub,
      hasBadge: true,
      badgeValue: summCount,
      classes:"tablet-only-hidden mobile-hidden",
      hyperlinkAct: "window.app.ObtainMenu(null, 'null', 'summary', "+ settings.toAxonCode +")"
    }
  ]
end


def ​

func:finSyncHisForm ​

finSyncHisForm(ids, syncFunc) ​

Axon function


meta ​

deffunc:finSyncHisForm
isfunc
liblib:finStackMobile
namefinSyncHisForm

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(ids, syncFunc) => do
  ids = ids.map x=> x[1..-1].parseRef
  ids = ids.findAll x=> x.readById.has("his")

  if(ids.size == 0)
    return finFormAlertOk(toLocale("finStackMobileExt::hisError"), toLocale("finStackMobileExt::syncErr"))

  thisDay: today()
  sevenDayAgo: thisDay - 7day

  body: [
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::syncFrom")},
    {name: "startDay", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::startDay"), minVal: 1, maxVal: 31, defVal: sevenDayAgo.day},
    {name: "startMonth", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::startMonth"), minVal: 1, maxVal: 12, defVal: sevenDayAgo.month},
    {name: "startYear", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::startYear"), minVal: 1970, maxVal: sevenDayAgo.year, defVal: sevenDayAgo.year},
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::syncTo")},
    {name: "endDay", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::endDay"), minVal: 1, maxVal: 31, defVal: thisDay.day},
    {name: "endMonth", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::endMonth"), minVal: 1, maxVal: 12, defVal: thisDay.month},
    {name: "endYear", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::endYear"), minVal: 1970, maxVal: thisDay.year, defVal: thisDay.year},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "commitButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  {
    "dis": toLocale("finStackMobileExt::syncHis"),
    "name": "finSyncHisForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$commitButton",
    "commitAction": syncFunc + "(readByIds(" + ids.toAxonCode + "), toDateSpan(date(\$startYear, \$startMonth, \$startDay) .. date(\$endYear, \$endMonth, \$endDay)))",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finTraceSubEquip ​

finTraceSubEquip(curEquipRef, query, pointsOnly, returnWhenFound) ​

Axon function


meta ​

deffunc:finTraceSubEquip
isfunc
liblib:finStackMobile
namefinTraceSubEquip

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finUniversalServiceRestart ​

finUniversalServiceRestart() ​

Axon function


meta ​

deffunc:finUniversalServiceRestart
isfunc
liblib:finStackMobile
namefinUniversalServiceRestart
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  if(readCount(ext=="finWindowsDevice") > 0)
    finFormWinRestart()
  else if(readCount(ext=="finLinuxDevice") > 0)
    finLinuxPower()
  else
  do
    body: [
      {name: "label", editorType: "label", text: toLocale("finStackMobileExt::winOrLinuxPodNotFound")},
      {name: "label", editorType: "label", text: toLocale("finStackMobileExt::enableCorrectOsPod")},

      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
    ]

    {
      "dis":  toLocale("finStackMobileExt::serviceRestart"),
      "name": "finUniversalServiceRestart",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:finValidateEmail ​

finValidateEmail(email) ​

Returns true if email is in the form [userName]@[domain].[topLevelDomain] and returns false if not.

Note: the TLD can be 2 - 9 characters in length.


meta ​

deffunc:finValidateEmail
isfunc
liblib:finStackMobile
namefinValidateEmail
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(email) => do
  if(reMatches(r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+[a-zA-Z0-9]\.[a-zA-Z]{2,9}", email))
    return true
  else
    return false
end


def ​

func:finWeatherMenu ​

finWeatherMenu() ​

Axon function


meta ​

deffunc:finWeatherMenu
finStackMobileMenu✓
isfunc
liblib:finStackMobile
namefinWeatherMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  if (not finServiceCheck("weather", "weather"))
    return []

  return [
    {
      displayName: toLocale("finStackMobileExt::rightMenuWeather"),
      appId: "weatherApp",
      icon: "wi-cloud",
      iconType: "class",
      ui: "html",
      minUiTarget: "phone",
      order: 11,
      action: ["window.app.ObtainMenu(null, '{{targetRef}}', 'weatherApp', "+ finWeatherSettings("forMenu2").toAxonCode +")"].concat("\n"),
      hasBadge: true,
      badgeType: "normal",
      badgeValue: readCount(weatherStation and geoCoord),
      keepOpen: true,
    }
  ]
end


def ​

func:findEquipTreeAddOpts ​

findEquipTreeAddOpts(rawNavMetaPath, curNavIndex, curNavStr, recordRef) ​

Axon function


meta ​

deffunc:findEquipTreeAddOpts
isfunc
liblib:finStackMobile
namefindEquipTreeAddOpts

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:folderPathDelete ​

folderPathDelete(folderPathToRemove, folderInfo: null) ​

Axon function


meta ​

deffunc:folderPathDelete
isfunc
liblib:finStackMobile
namefolderPathDelete
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(folderPathToRemove, folderInfo: null) => do
  treeTagFilters:{
    graphics: "graphicOn",
    programs: "programOn",
    schedules: "schedule",
    template: "templateOn or finTemplate"
  }

  //if empty folder
  if(folderPathToRemove.isRef and not folderPathToRemove.toStr.startsWith("folderPath"))
    return finHardDelete(folderPathToRemove)

  //if folderId is passed
  else if(folderPathToRemove.isRef)
    folderPathToRemove = folderPathToRemove.finIdToFolderPath

  //if folderPath is passed
  else
    folderPathToRemove = cleanFolderPathName(folderPathToRemove)

  //removes all matching folderPaths regardless of tree (may never be reached due to code changes
  if(folderInfo != null and folderInfo["treeTag"] == null) do
    //remove exact then remove paths that start with it
    readAll(folderPath == folderPathToRemove or "/"+folderPath == folderPathToRemove).each x => x.diff({-folderPath}).commit

    readAll(folderPath)
      .findAll(v => v->folderPath.startsWith(folderPathToRemove +"/") or ("/"+v->folderPath).startsWith(folderPathToRemove + "/"))
      .each x => do
        if(x->folderPath.startsWith("/")) x.diff({folderPath: x->folderPath.replace("/"+folderPathToRemove, "")}).commit
        else x.diff({folderPath: x->folderPath.replace(folderPathToRemove, "")}).commit
      end
  end

  //removes folderPaths from the current tree
  else if(folderInfo != null) do
    folderInfo = folderInfo.merge({name: folderPathToRemove.split("/")[-1]})
    queryStr: treeTagFilters[folderInfo->treeTag]

    if (queryStr == null)
      queryStr = "("+folderInfo->treeTag+" or "+folderInfo->treeTag+"Folder)"
    // remove exact matches
    readAll(parseFilter("folderPath and " + queryStr))
      .findAll(v => not v->folderPath.isEmpty and cleanFolderPathName(v->folderPath).startsWith(folderPathToRemove))
      .each(x => do
        curPath: cleanFolderPathName(x->folderPath)

        if(curPath == folderInfo->name)
          x.diff({-folderPath}).commit
        else
          x.diff({folderPath: curPath.replace(folderPathToRemove, folderPathToRemove.split("/")[0..-2].concat("/"))}).commit
      end)
  end //end if folderInfo

  else do
    ""
  end
end


def ​

func:folderPathEdit ​

folderPathEdit(folderId, newName) ​

Axon function


meta ​

deffunc:folderPathEdit
isfunc
liblib:finStackMobile
namefolderPathEdit
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

/*
  folder id is assumed to be in the following format: @folderPath:TREE_TYPE:FOLDER_PATH
*/
(folderId, newName) => do
  treeNameTags: {
    schedules: "(schedule or scheduleFolder)",
    programs: "(programOn or programFolder)",
    graphics:"(fin5 or graphicFolder)"
  }

  idAsList: folderId.toStr.split(":")
  oldPath: idAsList[-1].finIdToFolderPath()
  newPath: oldPath.split("/")[0..-2].add(newName).concat("/")
  treeTag: treeNameTags[idAsList[1]]

  /*
    if the proper query tags are not defined for
    the treeType indicated by the folder's id
    then assume the treeType can be used as a query
  */
  if(treeTag == null) treeTag = "("+idAsList[1]+" or "+idAsList[1]+"Folder)"

  /*
    readAll items of the same tree type
    that start with the old folder path
    and replace it with the new folder path
    which contains the new folder name
  */
  readAll(parseFilter(treeTag + " and folderPath != \"\""))
    .findAll(item => cleanFolderPathName(item->folderPath).startsWith(oldPath)).toRecList
    .map(item => item.diff({folderPath: item->folderPath.replace(oldPath, newPath)})).commit
end


def ​

func:folderPathMove ​

folderPathMove(item, newFolderPath, treeTagName: "", emptyFolderId: null) ​

Axon function


meta ​

deffunc:folderPathMove
isfunc
liblib:finStackMobile
namefolderPathMove
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item, newFolderPath, treeTagName: "", emptyFolderId: null) => do
  treeTagFilters:{
    graphics: "fin5",
    programs: "program",
    schedules: "schedule",
    template: "templateOn,finTemplate"
  }

  curFolderPath: ""
  itemTypeTag: treeTagFilters[treeTagName]
  queryStr: ""
  multiTags: false

  if(item.toStr.startsWith("folderPath")) curFolderPath = item.finIdToFolderPath()
  else curFolderPath = readById(item)["folderPath"]

  if (curFolderPath != null) curFolderPath = cleanFolderPathName(curFolderPath)
  if (itemTypeTag == null) itemTypeTag = treeTagName

  multiTags = itemTypeTag.contains(",")
  //queryStr = "("+treeTagName+" or "+treeTagName+"Folder)"
  queryStr = "("+(if (multiTags) itemTypeTag.replace(",", " or ") else itemTypeTag)+" or "+treeTagName+"Folder)"

  // moving some sort of record to a "folder"
  // if new folder is empty, remove folderPath
  if(not item.toStr.startsWith("folderPath:")) do
    if(newFolderPath.isEmpty()) readById(item).diff({-folderPath}).commit
    else readById(item).diff({folderPath:newFolderPath}).commit
  end

  // moving a "folder" to another "folder"
  // gets all things with a matching folder path
  // filters out by record type if possible
  // change all remaing items to have folder path that has the newFolderPath
  // at the start and then the rest of the original folderPath
  else do
    itemsToMove: readAll(folderPath and folderPath != "").findAll(v => cleanFolderPathName(v->folderPath).startsWith(curFolderPath))

    if(itemTypeTag != null and not itemTypeTag.isEmpty)
      itemsToMove = itemsToMove.findAll(v =>
      do
        hasItemTag: if (multiTags) itemTypeTag.split(",").find(z => v.has(z)) != null else v.has(itemTypeTag)

        return hasItemTag or (not multiTags and v.has(itemTypeTag+"Folder")) or (multiTags and v.has(treeTagName+"Folder"))
      end)

    if(newFolderPath != "") newFolderPath = newFolderPath + "/" + curFolderPath.split("/")[-1]
    else newFolderPath = curFolderPath.split("/")[-1]

    itemsToMove.each x => x.diff({folderPath: newFolderPath}).commit
  end

  if(item.toStr.startsWith("folderPath"))
    curFolderPath = curFolderPath.split("/")[0..-2].concat("/")

  // delete the emptyFolder record if it is the drop target
  if(emptyFolderId != null)
    folderPathDelete(emptyFolderId)

  if(curFolderPath != null and curFolderPath != "") do
    curFolderSize: readAll(parseFilter("folderPath and folderPath != \"\" and " + queryStr)).map(r => do
      r.merge({folderPath: cleanFolderPathName(r->folderPath)})
    end).findAll(v => v->folderPath.startsWith(curFolderPath)).size

    if (curFolderSize == 0)
    do
      try
        curFolderSize = eval(finNavTreeTypes(false, {name: treeTagName})).findAll(z => z["folderPath"] != null and z->folderPath.trim != "" and cleanFolderPathName(z->folderPath).startsWith(curFolderPath)).size
      catch //(e)
        null
    end

    if(curFolderSize == 0) do
      curFolderPath = curFolderPath.split("/")

      if (itemTypeTag == "fin5") itemTypeTag = "graphicFolder"
      else if (multiTags) itemTypeTag = treeTagName+"Folder"
      else itemTypeTag = itemTypeTag + "Folder"

      if(curFolderPath.size > 1)
        diff(null, {dis: curFolderPath[-1], emptyFolder, icon: "icon-folder", folderPath: curFolderPath[0..-2].concat("/")}.set(itemTypeTag, marker()), {add}).commit
      else
        diff(null, {dis: curFolderPath[0], emptyFolder, icon: "icon-folder"}.set(itemTypeTag, marker()), {add}).commit
    end
  end
end


def ​

func:folioDebugQueryForm ​

folioDebugQueryForm(col) ​

Axon function


meta ​

deffunc:folioDebugQueryForm
isfunc
liblib:finStackMobile
namefolioDebugQueryForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(col) => do
  asdf: folioDebugQueries().find(x=> x->pattern == col)
  text: ""
  asdf.names.each x=> do
    if(asdf.has(x)) text = text + x + ":\n\t" + asdf.trap(x) + "\n\n"
  end

  body: [
  {name: "asdf", editorType: "textarea", editable: false, defVal: text, height: 200},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackExt::view")+" "+toLocale("finStackMobileExt::folioDebugQueryTimes")+" : "+col,
  "name": "folioDebugQueryForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioDebugTagForm ​

folioDebugTagForm(col) ​

Axon function


meta ​

deffunc:folioDebugTagForm
isfunc
liblib:finStackMobile
namefolioDebugTagForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(col) => do
  asdf: folioDebugReadsByTag().find(x=> x->tag == col)
  text: ""
  asdf.names.each x=> do
    text = text + x + ":\n\t" + asdf.trap(x) + "\n\n"
  end

  body: [
  {name: "asdf", editorType: "textarea", editable: false, defVal: text, height: 200},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackExt::view")+" "+toLocale("finStackMobileExt::folioDebugTagIndex")+" : "+col, //"View Tag Index : "+col,
  "name": "folioDebugTagForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioDebugWatchesForm ​

folioDebugWatchesForm(col) ​

Axon function


meta ​

deffunc:folioDebugWatchesForm
isfunc
liblib:finStackMobile
namefolioDebugWatchesForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(col) => do
  asdf: folioDebugWatches().find(x=> x->id == col)
  text: ""
  asdf.names.each x=> do
    text = text + x + ":\n\t" + asdf.trap(x) + "\n\n"
  end

  body: [
  {name: "asdf", editorType: "textarea", editable: false, defVal: text, height: 200},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackExt::view")+" "+toLocale("finStackMobileExt::folioDebugWatches")+" : "+col,
  "name": "folioDebugWatchesForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioFileAddTagForm ​

folioFileAddTagForm(id, num, stage: null) ​

Axon function


meta ​

deffunc:folioFileAddTagForm
isfunc
liblib:finStackMobile
namefolioFileAddTagForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,num,stage:null) => do
  if(stage == null) do
    types: [{a:toLocale("finStackExt::string"),b:"str"},{a:toLocale("finStackExt::number"),b:"num"},{a:toLocale("finStackExt::marker"),b:"mkr"},{a:toLocale("finStackExt::boolean"),b:"bool"},{a:toLocale("finStackExt::folioQueryRef"),b:"ref"},{a:toLocale("finStackExt::folioFilesURI"),b:"uri"}]

    body: [
    {name: "name", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioFilesName"), defVal: ""}, //string number bool ref uri marker
    {name: "type", editorType: "combobox", prompt: toLocale("finStackMobileExt::folioQueryTagType"), dataProvider: types.toAxonCode, labelField: "a", selectedValueTags: "b", defIndex: 0},
    {name: "value", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioFilesAssignTag"), defVal: ""},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    compact: finFolioSettings("folioFileMenu").set("funcCall","folioFileMenu3(@"+id+","+num+")").toAxonCode
    compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"
    compact = "setTimeout(function(){ "+compact+"; }, 500)"

    { "dis": toLocale("finStackMobileExt::folioQueryAddTagTo")+" "+readById(id).dis,
    "name": "folioFileEditForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "folioFileAddTagForm(@"+id+",0,[\$name,\$type,\$value])",
    "completeAction": compact,
    "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
  else do
    apply: true
    val: 0
    try
      if(stage[1] == "str") val = toStr(stage[2])
      else if(stage[1] == "num") val = parseNumber(stage[2])
      else if(stage[1] == "mkr") val = marker()
      else if(stage[1] == "bool") val = parseBool(lower(stage[2]))
      else if(stage[1] == "ref") val = parseRef(replace(stage[2],"@",""))
      else if(stage[1] == "uri") val = parseUri(stage[2])
      else apply = false
    catch apply = false

    if(apply) readById(id).diff({}.set(stage[0], val)).commit
  end
end


def ​

func:folioFileBatchTrashForm ​

folioFileBatchTrashForm(inp) ​

Axon function


meta ​

deffunc:folioFileBatchTrashForm
isfunc
liblib:finStackMobile
namefolioFileBatchTrashForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(inp) => do
  stuff: ["[]","secureReadAll(file)","secureReadAll(fin5)","secureReadAll(finModel)","secureReadAll(finProject)","secureReadAll(finTheme)",
    "secureReadAll(file).findAll(x=> x->file.toStr.contains(\"image\"))"][inp]
  title: ["",toLocale("finStackMobileExt::reportsPromptAllFilters"),toLocale("finStackMobileExt::folioFilesFin5"),toLocale("finStackMobileExt::folioFilesFinModel"),toLocale("finStackMobileExt::folioFilesFinProject"),toLocale("finStackMobileExt::folioFilesFinTheme"),toLocale("finStackExt::folioFilesImages")][inp]

  body: [
  {name: "list", editorType: "list", dataProvider: stuff+".sort(\"dis\")", listType: "checkbox", labelField: "dis", selectedValueTags: "id", height: 200},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::delete"), controlBar: true}
  ]

  compact: finFolioSettings("folioFileMenu").set("funcCall","folioFileMenu2("+inp+")").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

  { "dis": toLocale("finStackExt::delete")+" "+title+" "+toLocale("finStackMobileExt::folioMenuFiles"),
  "name": "folioFileBatchTrashForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "each(\$list, x=> readById(x).diff({trash: marker()}).commit)",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioFileEditForm ​

folioFileEditForm(id, col, num) ​

Axon function


meta ​

deffunc:folioFileEditForm
isfunc
liblib:finStackMobile
namefolioFileEditForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,col,num) => do
  body: [
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  val: readById(id).trap(col)
  if(val.isNumber) do
    body = body.add({name: "cont", editorType: "numericstepper", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackExt::number"), defVal: val})
    comiact: "readById(@"+id+").diff({"+col+": \$cont}).commit"
  end
  else if(val.debugType == "haystack::Marker") do
    body = body.add({name: "cont", editorType: "textinput", prompt: toLocale("finStackMobileExt::host.cr.rename")+" "+toLocale("finStackExt::marker"), defVal: col})
    comiact: "readById(@"+id+").diff({\$cont: readById(@"+id+")->"+col+", -"+col+"}).commit"
  end
  else if(val.isBool) do
    body = body.add({name: "cont", editorType: "combobox", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackExt::boolean"), dataProvider: "[{a:\""+toLocale("finStackExt::valTrue")+"\",b:true},{a:\""+toLocale("finStackExt::valFalse")+"\",b:false}]", labelField: "a", selectedValueTags: "b", defIndex: if(val) 0 else 1})
    comiact: "readById(@"+id+").diff({"+col+": \$cont}).commit"
  end
  else if(val.isRef) do
    body = body.add({name: "cont", editorType: "textinput", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackExt::folioQueryRef"), tagName: "equip", defVal: "@"+val})
    comiact: "readById(@"+id+").diff({"+col+": parseRef(replace(\$cont,\"@\",\"\"))}).commit"
  end
  else if(val.isUri) do
    body = body.add({name: "cont", editorType: "textarea", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackExt::folioFilesURI"), defVal: val})
    comiact: "readById(@"+id+").diff({"+col+": parseUri(\$cont)}).commit"
  end
  else if(val.isStr) do
    body = body.add({name: "cont", editorType: "textarea", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackExt::string"), defVal: val})
    comiact: "readById(@"+id+").diff({"+col+": \$cont}).commit"
  end
  else do
    body = body.addAll([
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioFilesEditUnknown")},
    {name: "cont", editorType: "textarea", prompt: toLocale("finStackExt::coreEdit")+" "+toLocale("finStackMobileExt::weatherMenuUnknown"), defVal: val.toStr},
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioFilesEditUnknown")}
    ])
    comiact: "readById(@"+id+").diff({"+col+": \$cont}).commit"
  end

  compact: finFolioSettings("folioFileMenu").set("funcCall","folioFileMenu3(@"+id+","+num+")").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"
  compact = "setTimeout(function(){ "+compact+"; }, 300)"

  { "dis": toLocale("finStackExt::coreEdit")+" '"+readById(id).dis+"' : "+col,
    "name": "folioFileEditForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": comiact,
    "completeAction": compact,
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioFileTrashForm ​

folioFileTrashForm(inp, num) ​

Axon function


meta ​

deffunc:folioFileTrashForm
isfunc
liblib:finStackMobile
namefolioFileTrashForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(inp,num) => do
  body: [
  {name: "label", editorType: "label", text: toLocale("finStackExt::folioFilesDeleteMsg").replace("{0}",readById(inp).dis)},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::delete"), controlBar: true}
  ]

  compact: finFolioSettings("folioFileMenu").set("funcCall","folioFileMenu2("+num+")").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

  { "dis": toLocale("finStackExt::delete")+" '"+readById(inp).dis+"'",
  "name": "folioFileTrashForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "readById(@"+inp+").diff({trash: marker()}).commit",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioFileUploadForm ​

folioFileUploadForm() ​

Axon function


meta ​

deffunc:folioFileUploadForm
isfunc
liblib:finStackMobile
namefolioFileUploadForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  body: [
  {name: "file", editorType: "file", prompt: toLocale("finStackMobileExt::folioFilesUploadHere")},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackMobileExt::licenseUploadRestart"), controlBar: true}
  ]

  compact: "window.app.ObtainMenu(null, 'null','folio',"+finFolioSettings("folioFileMenu").toAxonCode+")"

  { "dis": toLocale("finStackMobileExt::omMenuUploadFile"),
  "name": "folioFileUploadForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "readById(\$file)",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioOrphanCleanup ​

folioOrphanCleanup(id: null) ​

Axon function


meta ​

deffunc:folioOrphanCleanup
isfunc
liblib:finStackMobile
namefolioOrphanCleanup
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id: null) => do
  rec: readById(id, false)
  if(rec != null and rec.has("trash")) do
    try rec.finHardDelete() catch echo("Error deleting: " + id.toStr)
  end
  {}.toGrid
end


def ​

func:folioOverwriteFileCommit ​

folioOverwriteFileCommit(fileId, loadedFile) ​

Axon function


meta ​

deffunc:folioOverwriteFileCommit
isfunc
liblib:finStackMobile
namefolioOverwriteFileCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(fileId, loadedFile) => do
  finWriteBinTag(readById(fileId), "file", finReadBinTag(readById(loadedFile[0]), "file"))
  readById(loadedFile[0]).finHardDelete()
end


def ​

func:folioOverwriteFileForm ​

folioOverwriteFileForm(fileId, codeOrWhatever) ​

Axon function


meta ​

deffunc:folioOverwriteFileForm
isfunc
liblib:finStackMobile
namefolioOverwriteFileForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(fileId, codeOrWhatever) => do
  body:[
    {
      name: "files",
      editorType: "file",
      fileTypes: [""],
      prompt: toLocale("finStackMobileExt::folioFilesOvrWrtMsg")+" " + readById(fileId).dis,
      multiple: false
    },

    { name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true },
    { name: "applyButton", editorType: "button", label: toLocale("finStackMobileExt::folioFilesOverwrite"), controlBar: true }
  ]

  { "dis": toLocale("finStackMobileExt::folioFilesOverwrite")+" " + readById(fileId).dis,
    "name": "folioOverwriteFileForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "folioOverwriteFileCommit("+fileId.toAxonCode+", \$files)",
    "completeAction": "window.app.ObtainMenu(null, 'null','folio',"+finFolioSettings("folioFileMenu").set("funcCall","folioFileMenu2("+codeOrWhatever+")").toAxonCode+")",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioQueryForm ​

folioQueryForm(stage: null, ext: "") ​

Axon function


meta ​

deffunc:folioQueryForm
isfunc
liblib:finStackMobile
namefolioQueryForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(stage: null, ext: "") => do
  if(stage == null) do
    body: [
    {name: "query", editorType: "textarea", prompt: toLocale("finStackMobileExt::folioQueryQuery"), defVal: ext.replace(toChar(8),"\"")},
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioQueryUse")},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::next"), controlBar: true}
    ]

    { "dis": toLocale("finStackExt::folioQueryRunQuery"), //"Run Folio Query",
    "name": "folioQueryForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "folioQueryForm(\$query)",
    "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
  else do
    body: [
      {name: "label", editorType: "label", prompt: toLocale("finStackMobileExt::folioQueryPressOk")+" "+stage},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::folioQueryRun"), controlBar: true}
    ]

    stage = stage.replace("\"",toChar(8)).replace("\n", "").trim

    compact: finFolioSettings("folioFileMenu").set("funcCall","folioQueryMenu('"+ stage +"')").toAxonCode
    compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

    { "dis": toLocale("finStackMobileExt::folioQueryConfirm"), //"Confirmation",
    "name": "folioQueryForm2",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "0",
    "completeAction": compact,
    "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:folioQueryMenu ​

folioQueryMenu(stage: null) ​

Axon function


meta ​

deffunc:folioQueryMenu
isfunc
liblib:finStackMobile
namefolioQueryMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(stage: null) => do
  if(stage == null) stage = read(folioQueryMenu and settings)->query
  else do
    stage = stage.replace(toChar(8),"\"")
    if(readCount(folioQueryMenu and settings) > 0) read(folioQueryMenu and settings).diff({query: stage}).commit
    else diff(null,{query: stage, folioQueryMenu: marker(), settings: marker()},{add}).commit
  end

  list: [ finFolioSettings("refresh",finFolioSettings("folioFileMenu").set("funcCall","folioQueryMenu('"+stage+"')")), {
    displayName: toLocale("finStackMobileExt::folioQueryNew"),
    appId: "folio",
    ignoreSettings: marker(),
    action: "finstack.eval('folioQueryForm()')",
    icon: "icon-plus",
    iconType: "class",
    keepOpen:true,
    ui: "html",
    minUiTarget: "phone",
    order: -1008 },
    {
    displayName: toLocale("finStackMobileExt::folioQueryEdit"),
    appId: "folio",
    ignoreSettings: marker(),
    action: "finstack.eval('folioQueryForm(null,"+stage.replace("\"",toChar(8)).toAxonCode+")')",
    icon: "icon-document-edit",
    iconType: "class",
    keepOpen:true,
    ui: "html",
    minUiTarget: "phone",
    order: -1007 }
  ]

  sts: ""

  try stuff: eval(stage)
  catch try stuff: eval("secureReadAll(" + stage + ")")
  catch(e) do stuff: e; stage = stage + " :Error"; sts = "error" end
  if(not stuff.isGrid and not stuff.isList and not stuff.isDict) stuff = [stuff]
  if(stuff.isDict and stuff.has("id")) stuff = [stuff].toGrid

  stn1: {}

  ico: "information"
  if(stuff.isGrid) stuff.each x=> do
    if(x.has("site")) ico = "sm-site"
    else if(x.has("floor")) ico = "sm-floors"
    else if(x.has("equip")) ico = "sm-equip"
    else if(x.has("point")) ico = "sm-point"
    else if(x.has("schedule")) ico = "icomoon-schedule"
    else if(x.has("program")) ico = "icon-document"
    else if(x.has("func")) ico = "icon-code"
    else ico = "icon-question"
    if(x.has("id")) do
      stn1 = { header: "query", display: "dis", hideBackButton: true,
        funcCall: "mobileViewRecordInfo(@"+x->id+", 'folio', {header: 'query', funcCall: 'folioQueryMenu()', display: 'dis', hideBackButton: true})"}
    end
    list = list.add({
      displayName: x.dis,
      appId: "folio", ignoreSettings: marker(),
      action: (if(x.has("id")) "window.app.ObtainMenu(null, 'null', 'folio'," + stn1.toAxonCode +")"
        else "finstack.eval('folioQueryViewForm("+x.toAxonCode+")')"),
      hasBadge: x.has("curVal"), badgeValue: (if(x.has("curVal")) x->curVal.toStr.finStrGet(0,10) else 0), badgeType: sts,
      icon: ico, iconType: "class",
      keepOpen:true, ui: "html", minUiTarget: "phone", order: 0 })
  end
  else if(stuff.isList) stuff.each x=> list = list.add({
    displayName: x.toStr,
    appId: "folio", ignoreSettings: marker(),
    action: "finstack.eval('folioQueryViewForm("+x.toAxonCode+")')",
    icon: "icon-"+ico, iconType: "class",
    hasBadge: true, badgeValue: x.debugType.replace("::",toChar(8)).split(toChar(8))[1],
    keepOpen:true, ui: "html", minUiTarget: "phone", order: 0 })
  else if(stuff.isDict) stuff.each()(x,y)=> list = list.add({
    displayName: x.toStr.finStrGet(0,25),
    appId: "folio", ignoreSettings: marker(),
    action: "finstack.eval('folioQueryViewForm("+x.toAxonCode+")')",
    icon: "icon-"+ico, iconType: "class",
    hasBadge: true, badgeValue: y, badgeType: sts,
    keepOpen:true, ui: "html", minUiTarget: "phone", order: 0 })

  list.addAll(finStackMenuBackButton(toLocale("finStackMobileExt::rightMenuFolio")+" "+toLocale("finStackMobileExt::folioQueryQuery")+" "+stage, finFolioSettings("forMenu2"), "folio")).toGrid
end


def ​

func:folioQueryViewForm ​

folioQueryViewForm(ext) ​

Axon function


meta ​

deffunc:folioQueryViewForm
isfunc
liblib:finStackMobile
namefolioQueryViewForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(ext) => do
  try do
  trns: g=> g.debugType.replace("::",toChar(8)).split(toChar(8)).finStrGet(1)[0]

  text: ""
  if(ext.isDict) ext.each()(x,y)=> do
    text = text + y + "\t (" + x.trns + ")" + "\n\t" + x + "\n\n"
  end
  else if(ext.isList) ext.each()(x,y)=> do
    text = text + "val " + y + "\t (" + x.trns + ")" + "\n\t" + x + "\n\n"
  end
  else text = text + "val\t ("+ ext.trns +")\n\t" + ext + "\n\n"
  text = text[0..-3]

  body: [
  {name: "query", editorType: "textarea", prompt: toLocale("finStackMobileExt::gbQuery")+":", defVal: text, height: 200, editable: false},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::viewQueryElement"),
  "name": "folioQueryViewForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
  end catch(e) echo(e)
end


def ​

func:folioSnapRestoreProgBar ​

folioSnapRestoreProgBar(stage: null) ​

Axon function


meta ​

deffunc:folioSnapRestoreProgBar
isfunc
liblib:finStackMobile
namefolioSnapRestoreProgBar
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(stage: null) => do
  if(stage == 1) do
    prog: 0
    (1..31536000).eachWhile x=> do
      jobSleep(1sec)
      prog = (try readProjStatus()->progress catch 100)
      jobProgress(prog, "")
      if(prog == 100) true
      else null
    end
  end
  else do
    {}.toGrid.addMeta({showJobProgress: jobRun(folioSnapRestoreProgBar(1)), doneCommand:
    "setTimeout(function(){ finstack.eval('folioSnapRestoreRestart()') }, 3500)",
    errorCommand: "finstack.eval('finFormAlertOk(\""+toLocale("finStackMobileExt::folio.lite.error")+"\", \""+toLocale("finStackMobileExt::folioSnapFailed")+"\")')"
    })
  end
end


def ​

func:folioSnapRestoreRestart ​

folioSnapRestoreRestart() ​

Axon function


meta ​

deffunc:folioSnapRestoreRestart
isfunc
liblib:finStackMobile
namefolioSnapRestoreRestart
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  os: toLocale("finStackMobileExt::weatherMenuUnknown")
  ex: exts().colToList("name")
  if(ex.index("finWindowsDevice") != null) os = "Windows"
  else if(ex.index("finLinuxDevice") != null) os = "Linux"
  if(os != toLocale("finStackMobileExt::weatherMenuUnknown")) finSettingsAction("fin"+os+"Device", false, false)

  body: [
  {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioSnapRecommend")},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  q: {"dis": toLocale("finStackMobileExt::coreRestore")+" "+toLocale("finStackMobileExt::folioSnapRestart"),
      "name": "folioSnapRestoreRestart",
      "cancelButton": "\$cancelButton",
      "finForm": marker() }

  if(os != toLocale("finStackMobileExt::weatherMenuUnknown") and readCount(ext=="finWindowsDevice" or ext=="finLinuxDevice") > 0) do
    if(os == "Windows") comAct: "finWinRestartFinstack()"
    else if(os == "Linux") comAct: "finLinuxRestartFinstack()"
    body = body.addAll([
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioSnapOS")+" "+os},
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioSnapClickRestart")+" "+os},
    {name: "commitButton", editorType: "button", label: toLocale("finStackMobileExt::folioSnapRestart"), controlBar: true}
    ])
    q = q.set("commitButton","\$commitButton").set("commitAction",comAct)
  end

  q.set("body",body.toJSON).toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioSnapUploadForm ​

folioSnapUploadForm(stage: null) ​

Axon function


meta ​

deffunc:folioSnapUploadForm
isfunc
liblib:finStackMobile
namefolioSnapUploadForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(stage: null) => do
  if(stage == null or (stage.isList and not stage.isEmpty and stage[0] == "")) do
    body: [
    {name: "upload", editorType: "file", prompt: toLocale("finStackMobileExt::folioSnapUploadSnap"), fileTypes: ["zip"]},
    {name: "ndis", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioSnapOptionalDis"), defVal: ""},
    {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioSnapRefreshMsg")},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackMobileExt::licenseUploadRestart"), controlBar: true}
    ]

    { "dis": toLocale("finStackMobileExt::folioSnapUploadSnap"),
    "name": "folioSnapUploadForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "folioSnapUploadForm([\$upload, 1])",
    "completeAction": "window.app.ShowLoader('Uploading file...'); finstack.eval('folioSnapUploadForm([\$upload, trim(\$ndis)])').then(function(event) { window.app.HideLoader(); window.app.ObtainMenu(null, null,'folio',"+finFolioSettings("folioSnapMenu").toAxonCode+"); });",
    "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
  /////// handle upload start
  else if (stage[1] == 1) do
    // Mark upload record as temporary
    id: stage[0]
    readById(id).diff({trash: marker()}).commit
    // Schedule cleanup job to remove file if upload never completes
    eval("jobRun([jobSleep(6hr),folioOrphanCleanup(parseRef(\""+ id.toStr + "\"))])")
  end
  ///////
  else try do
    tmp: folioBackups()
    finReadByIdTrash(stage[0]).finFileToSnapshot
    tmp2: folioBackups().find(x=> tmp.findAll(y=> y->ts == x->ts).size == 0)
    if(stage[1] != "" and tmp2 != null) finCreateSnapshotRecord(tmp2, {dis: stage[1]})
  end
  catch(e) do
    backupRec: finReadByIdTrash(stage[0], false)
    if (backupRec != null) backupRec.finHardDelete()
    finFormAlertOk(toLocale("finStackMobileExt::folio.lite.error"),toLocale("finStackMobileExt::folioRestoreUploadError"))
  end
end


def ​

func:folioTrashDeleteForm ​

folioTrashDeleteForm(id) ​

Axon function


meta ​

deffunc:folioTrashDeleteForm
isfunc
liblib:finStackMobile
namefolioTrashDeleteForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  id = readById(id)

  body: [
  {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioTrashDeleteMsg")+" "+ id.dis +"?"},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::delete"), controlBar: true}
  ]

  compact: finFolioSettings("folioTrashMenu").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

  { "dis": toLocale("finStackMobileExt::folioTrashDelete"), //"Delete Trash",
  "name": "folioTrashDeleteForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "readById(@"+ id->id +").diff({},{remove}).commit",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioTrashEmptyForm ​

folioTrashEmptyForm() ​

Axon function


meta ​

deffunc:folioTrashEmptyForm
isfunc
liblib:finStackMobile
namefolioTrashEmptyForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  body: [
  {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioTrashEmptyMsg")},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::no"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::yes"), controlBar: true}
  ]

  compact: finFolioSettings("folioTrashMenu").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

  { "dis": toLocale("finStackMobileExt::folioTrashEmpty"),
  "name": "folioTrashEmptyForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "folioEmptyTrash()",//"secureReadAll(trash).each x=> x.diff({},{remove}).commit",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioTrashRestoreForm ​

folioTrashRestoreForm(id) ​

Axon function


meta ​

deffunc:folioTrashRestoreForm
isfunc
liblib:finStackMobile
namefolioTrashRestoreForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  id = finReadByIdTrash(id)

  body: [
  {name: "label", editorType: "label", text: toLocale("finStackMobileExt::folioTrashRestoreMsg")+" "+ id.dis +"?"},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::no"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::yes"), controlBar: true}
  ]

  compact: finFolioSettings("folioTrashMenu").toAxonCode
  compact = "window.app.ObtainMenu(null, 'null', 'folio', "+ compact +")"

  { "dis": toLocale("finStackMobileExt::folioTrashRestore"), //"Restore Trash",
  "name": "folioTrashRestoreForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "finReadByIdTrash(@"+ id->id +").diff({-trash}).commit",
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:folioTrashViewForm ​

folioTrashViewForm(id) ​

Axon function


meta ​

deffunc:folioTrashViewForm
isfunc
liblib:finStackMobile
namefolioTrashViewForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  id = readById(id)
  names: id.names.findAll(x=> id.has(x))
  text: ""
  names.each x=> do
    text = text + x +": "+ id.trap(x) + "\n\n"
  end
  text = text[0..-3]

  body: [
  {name: "view", editorType: "textarea", editable: false, defVal: text, height: 200},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackExt::view")+" '"+id.dis+"'",
  "name": "folioTrashViewForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:getEnumAlarmText ​

getEnumAlarmText(curVal, alarmStateText: "null") ​

Axon function


meta ​

deffunc:getEnumAlarmText
isfunc
liblib:finStackMobile
namegetEnumAlarmText
overridable✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(curVal,alarmStateText:"null") => do
  stateText: []
  alarmText: []
  alarmStates: alarmStateText.split(";")

  alarmStates.each s => stateText = stateText.add(s.trim.upper)

  i: stateText.index(curVal.upper)

  if (i == null)
    return false
  else
    return true
end


def ​

func:graphicsBuilderNew ​

graphicsBuilderNew(id, secondId: null, viewAll: false, folderPath: null) ​

Axon function


meta ​

deffunc:graphicsBuilderNew
isfunc
liblib:finStackMobile
namegraphicsBuilderNew
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, secondId: null, viewAll: false, folderPath: null) => do
 if(id != null)
 do
    if(readById(id).has("floor") or (secondId != null and readById(secondId).has("floor")))
      finCreateFloorGraphic(id, secondId, viewAll, null, folderPath)
    else if(readById(id).has("equip") or (secondId != null and readById(secondId).has("equip")))
      finCreateEquipGraphic(id, secondId, viewAll, null, folderPath)
    else
      finCreateNavLevelGraphic(id, secondId, viewAll, null, folderPath)
 end
 else
    finCreateNavLevelGraphic(id, secondId, viewAll, null, folderPath)
end


def ​

func:graphicsMenu ​

graphicsMenu(targetRef, viewAll: false) ​

Axon function


meta ​

deffunc:graphicsMenu
isfunc
liblib:finStackMobile
namegraphicsMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef, viewAll:false) => do
  graphicList: secureReadAll(fin5 and not finTemplate).toRecList
  graphicCount: graphicList.size
  project: context()->projName
  menuItems: []
  topLevel: read(topLevel, false)

  optionsSubmenu: g=> do
    graphicDelete: "finstack.eval('finStackMenuDeleteConfirm(@" + g->id + ", \"Graphic\", {{targetRef}})')"
    if(topLevel != null and topLevel.has("finHomePath") and topLevel->finHomePath.contains(g->id.toStr.split(":")[-1]))
      graphicDelete = "finstack.eval('finGraphicTopLevelDeleteConfirmForm(@"+ g->id +", {{targetRef}})')"
    {
      startOpen: false,
      items: [{
        hideInMobile,
        label: toLocale("finStackExt::coreEdit"),
        keepOpen: true,
        icon: "icon-document-edit",
        tooltip: toLocale("finStackMobileExt::toolTipEditGraphicInApp")+".",
        action: if(targetRef != null) "window.app.LoadApplication('/graphicsBuilder/" + project + "/#graphicRef=@" + g->id + "&targetRef={{targetRef}}', '', '{{targetRef}}')" //; window.app.ToggleCollapse();"
                else "window.app.LoadApplication('/graphicsBuilder/" + project + "/#graphicRef=@" + g->id + "')"
            }, {
        label: toLocale("finStackExt::navMetaPoint"),
        keepOpen: true,
        icon: "sm-point",
        tooltip: toLocale("finStackMobileExt::toolTipViewPointsInGraphic")+".",
        action: "window.app.ObtainMenu(null, '{{targetRef}}','graphicsSelected', {funcCall: 'graphicsSelectedMenu(" + g->id.toAxonCode + ")', hideBackButton: true, display: 'name', keepOpen: true, iconFunc: 'graphicsVirtPtIcon()', iconClassFunc: 'graphicsVirtPtIconColor()', iconTooltip: '{binding}'})"
            }, {
        label: "graphicOn", //done
        icon: "icon-tag",
        tooltip: toLocale("finStackMobileExt::toolTipEditGraphicOn"),
        action: "finstack.eval('finEditGraphicOn(@" + g->id + ", {{targetRef}})')",
        keepOpen: true
            }, {
        label: toLocale("finStackExt::delete"), //done
        icon: "icon-trash",
        tooltip: toLocale("finStackMobileExt::toolTipDeleteCurrentGraphic")+".",
        action: graphicDelete,
        style: "background: red",
        keepOpen: true
      }]
    }
  end

  graphicList = graphicList.map(x=> x.set("ignoreSettings",marker())
    .set("action","null")
    .set("submenu", optionsSubmenu(x).toJSON())
    .set("funcCall","")
    .set("icon","icon-view-thumb")
    .set("iconType","class")
    .set("keepOpen",true)
    .set("displayName",x.dis))

  if(targetRef != null and not viewAll) do
    tempList: []
    graphicList = graphicList.each graphic => do
      try if(eval("secureReadAll(" + graphic->graphicOn + ")").find(v => v->id == targetRef) != null)
        tempList = tempList.add(graphic)
      catch ""
    end

    graphicList = tempList

    menuItems = menuItems.add({
      displayName: toLocale("finStackMobileExt::viewAllGraphics"),
      appId: "allGraphics",
      icon: "icon-photo-group",
      iconType: "class",
      level: 0,
      order: -1015,
      ignoreSettings,
      hasBadge: true,
      badgeValue: graphicCount,
      badgeTooltip: graphicCount + " graphics",
      action: "window.app.ObtainMenu('" + finGetCurrentUser()->username + "', '{{targetRef}}', 'allGraphics', " + graphicsMenuSettings(true).toAxonCode + ")",
      keepOpen: true
    })
  end

  toplevelmenu:{
    startOpen: false,
    items: [{
      label: toLocale("finStackExt::coreCreate"),
      icon: "icon-plus",
      tooltip: toLocale("finStackMobileExt::toolTipCreateTopLevelRec"),
      action: "finstack.eval('finGraphicTopLevel(true)')",
      keepOpen: true
      }, {
      label: toLocale("finStackExt::coreEdit"),
      icon: "icon-pencil",
      tooltip: toLocale("finStackMobileExt::toolTipEditTopLevelRec"),
      action: "finstack.eval('finGraphicTopLevel(false)')",
      keepOpen: true
      }]
  }.toJSON

  menuItems = menuItems.addAll([
    {displayName: toLocale("finStackMobileExt::graphicBuilderTitle"), isHeader: true, isDivider: true, ignoreSettings, order: -9999},
    {
      displayName: toLocale("finStackMobileExt::topLevelGraphic"),
      icon: "icon-photo",
      iconType: "class",
      ignoreSettings,
      action: "null",
      order: -1011,
      keepOpen: true,
      submenu: toplevelmenu
    },
    {
      displayName: toLocale("finStackExt::updateBindings"),
      icon: "icon-time-reverse",
      iconType: "class",
      ignoreSettings,
      action: "finstack.eval('finGraphicsGenericBindingsForm("+targetRef.toAxonCode+")')",
      order: -1010,
      keepOpen: true,
    },
    {
      displayName: toLocale("finStackExt::coreMisc"),
      icon: "icon-box",
      iconType: "class",
      ignoreSettings,
      action: "null",
      order: -1009,
      keepOpen: true,
      submenu: {items: [
        {
        label: toLocale("finStackMobileExt::coreBackup"),
        icon: "icon-download",
        tooltip: toLocale("finStackMobileExt::toolTipDLBackupsGraphics"),
        action: "finstack.eval('finFolioDownloadForm(\"fin5 and not finTemplate or finModel\",\"fin5\")')",
        keepOpen: true
        },
        {
        label: toLocale("finStackExt::restore"),
        icon: "icon-upload",
        tooltip: toLocale("finStackMobileExt::toolTipULBackupsGraphics"),
        action: "finstack.eval('finFolioUploadForm(null, null, \"graphics\")')",
        keepOpen: true
        },
        {
        label: toLocale("finStackMobileExt::coreOrganize"),
        icon: "icon-folder-open",
        tooltip: toLocale("finStackMobileExt::toolTipAddRemoveEditTags"),
        action: "finstack.eval('finOrganizeFolderpathForm(\"fin5 and not finTemplate\")')",
        keepOpen: true
        },
        {
        label: toLocale("finStackMobileExt::thumbnails"),
        icon: "icon-photo",
        tooltip: toLocale("finStackMobileExt::toolTipUDThumbnailsGraphics"),
        action: "finstack.eval('finGraphicsUpdateThumbs()')",
        keepOpen: true
        }
      ]}.toJSON
    }
  ]).addAll(graphicList)

  if(viewAll)
    menuItems = menuItems.addAll(finStackMenuBackButton(toLocale("finStackMobileExt::allGraphics"), graphicsMenuSettings(), "graphicsBuilder"))
  else menuItems = menuItems.add({displayName: toLocale("finStackMobileExt::allGraphics"), order: -1000, isDivider:true, ignoreSettings, header})

  menuItems
end


def ​

func:graphicsMenuSettings ​

graphicsMenuSettings(viewAll: false, id: null, target: null) ​

Axon function


meta ​

deffunc:graphicsMenuSettings
isfunc
liblib:finStackMobile
namegraphicsMenuSettings
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(viewAll:false, id: null, target: null) => do
  settings: {
    funcCall: if(id == null and target == null) "graphicsMenu({{targetRef}}," + viewAll.toAxonCode + ")" else if(id == null and target != null) "graphicsMenu(" + target.toAxonCode + "," + viewAll.toAxonCode + ")" else "graphicsMenu(" + id.toAxonCode + "," + viewAll.toAxonCode + ")",
    header: toLocale("finStackMobileExt::rightMenuGraphicsBuilder"),
    folderPath:"",
    action: "openMenu:null, null, 'graphicsSelected', {funcCall: 'graphicsSelectedMenu(@*~id*)', hideBackButton: true, display: 'name', keepOpen: true, iconFunc: 'graphicsVirtPtIcon()', iconClassFunc: 'graphicsVirtPtIconColor()', iconTooltip: '{binding}'}",//graphicAction,
    folderPathCount:0,
    icon: "icon-view-thumb",
    keepOpen: true,
    hideBackButton: true
  }

  settings
end


def ​

func:graphicsMobileMenu ​

graphicsMobileMenu() ​

Axon function


meta ​

deffunc:graphicsMobileMenu
finStackMobileMenu✓
isfunc
liblib:finStackMobile
namegraphicsMobileMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  graphicAction: "openApp:/finBuilder/{project}/#graphicRef={id}"
  numGraphics: readCount(fin5 and not finTemplate)

  settings: {
    funcCall:"graphicsMenu({{targetRef}})",
    folderPath:"",
    action: "openMenu:null, null, 'graphicsSelected', {funcCall: 'graphicsSelectedMenu(@*~id*)', hideBackButton: true, display: 'name', keepOpen: true, iconFunc: 'graphicsVirtPtIcon()', iconClassFunc: 'graphicsVirtPtIconColor()', iconTooltip: '{binding}'}",//graphicAction,
    folderPathCount:0,
    icon: "icon-view-thumb",
    keepOpen: true,
    hideBackButton: true
  }

  optionsSubmenu:{
    startOpen: false,
    items: [{
      label: toLocale("finStackMobileExt::dbLaunch"),
      icon: "icon-photo",
      tooltip: toLocale("finStackMobileExt::toolTipLaunchGBApp"),
      action: "window.app.LoadApplication('/graphicsBuilder/" + context()->projName + "/#targetRef={{targetRef}}'); window.app.ToggleCollapse(true)",
      hideInMobile
    }, {
      label: toLocale("finStackMobileExt::bLineNew"),
      icon: "icon-document-new",
      tooltip: toLocale("finStackMobileExt::toolTipCreateNewGraphic"),
      action: "finstack.eval('graphicsBuilderNew({{targetRef}}, null, false)')",
      keepOpen: true
    }, {
      label: toLocale("finStackMobileExt::tabBarMenu"), //toLocale("finStackExt::rightMenuGraphicsTitle"),
      icon: "icon-menu",
      tooltip: toLocale("finStackMobileExt::toolTipDiveDownMenu"),
      action: "window.app.ObtainMenu(null, '{{targetRef}}' ,'graphicsBuilder', "+ settings.toAxonCode +")",
      keepOpen: true
    }]
  }

  [{
    displayName: toLocale("finStackMobileExt::rightMenuGraphicsBuilder"),
    link: "",
    appId: "graphicsBuilder",
    icon: "icon-photo",
    iconType: "class",
    action: "null",
    level: 0,
    hasBadge: true,
    badgeValue: numGraphics,
    badgeTooltip: numGraphics + " Graphics",
    ui: "html",
    classes:"tablet-only-hidden mobile-hidden",
    submenu: optionsSubmenu.toJSON,
    keepOpen:true,
    order: 103,
    hyperlinkAct:"window.app.ObtainMenu(null, null,'graphicsBuilder', "+ settings.toAxonCode +")"
  }]
end


def ​

func:graphicsSelectedMenu ​

graphicsSelectedMenu(id) ​

Axon function


meta ​

deffunc:graphicsSelectedMenu
isfunc
liblib:finStackMobile
namegraphicsSelectedMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  project: context()->projName

  readById(id).readFinFile().map(row => if(row.has("virtualPoint") and not row.has("name")) try row.set("name", row->navName.toTagName) catch row.set("name", "") else row).writeFinFile(id)

  graphicVars:readById(id).readFinFile().findAll(v => v.has("virtualPoint")).keepCols(["name", "binding"]).map(row =>
    try row.set("action", "finstack.eval('finEditEquipGraphicPtBind(" + row->name.toAxonCode + "," + row->binding.toAxonCode + "," + id.toAxonCode+")')")
    catch row
  ).toRecList.findAll(v => v.has("name"))

  addSubmenu: {
    startOpen: false,
    items: [/*{
        label: toLocale("finStackExt::navMetaPoint"),
        icon: "sm-point",
        tooltip: toLocale("finStackMobileExt::toolTipAddPointsToGraphic")+".",
        action: "finstack.eval('graphicsBuilderNew(" + id.toAxonCode + ", {{targetRef}})')",
        keepOpen: true
      }, {
        label: toLocale("finStackMobileExt::hyperlinks"),
        icon: "icon-link",
        tooltip: toLocale("finStackMobileExt::toolTipAddHyperlinksToGraphic")+".",
        action: "finstack.eval('finGraphicAddHyperlink(" + id.toAxonCode + ", {{targetRef}})')",
        keepOpen: true
      }, */{
        label: toLocale("finStackMobileExt::coreOrganize"),
        icon: "icon-folder",
        tooltip: toLocale("finStackMobileExt::toolTipOrgGraphicIntoFolder")+".",
        action: "finstack.eval('finCreateFolderPath(" + id.toAxonCode + ",\"fin5\")')",
        keepOpen: true
            }]
  }.toJSON()

  [
    {displayName: toLocale("finStackMobileExt::graphicBuilderTitle"), isHeader: true, isDivider: true, ignoreSettings, order: -9999},

    {
      displayName: toLocale("finStackExt::weatherMenuAdd"),
      appId: "addPoints",
      action: "null",
      icon: "icon-plus",
      iconType: "class",
      order: 3,
      keepOpen: true,
      submenu: addSubmenu,
      ignoreSettings
    },

    {
      displayName: toLocale("finStackExt::virtualPoints"),
      isDivider: true,
      ignoreSettings,
      order: 6
    }
  ].addAll(finStackMenuBackButton(readById(id).dis, graphicsMenuSettings(), "graphicsBuilder")).addAll(graphicVars)
end


def ​

func:graphicsVirtPtIcon ​

graphicsVirtPtIcon(item) ​

Axon function


meta ​

deffunc:graphicsVirtPtIcon
isfunc
liblib:finStackMobile
namegraphicsVirtPtIcon
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  if(item->binding.contains("sensor"))
    return "sm-sensor"
  else if(item->binding.contains("cmd"))
    return "sm-command"
  else if(item->binding.contains("sp"))
    return "sm-softpoint"
  else
    return "sm-point"
end


def ​

func:graphicsVirtPtIconColor ​

graphicsVirtPtIconColor(item) ​

Axon function


meta ​

deffunc:graphicsVirtPtIconColor
isfunc
liblib:finStackMobile
namegraphicsVirtPtIconColor
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  color: ""
  kinds: readAllTagVals(point and navName == item->name, "kind")
  kind: ""

  if(kinds.size == 1)
    kind = kinds[0]->val
  else if(kinds.size != 0) do
    kindGrid: []
    //count diff types
    kinds.each x => do
      num: eval("secureReadAll(point and navName == " + item->name.toAxonCode + " and kind == " + x->val.toAxonCode + ").size")
      kindGrid = kindGrid.add({kind: x, count: num})
    end
    //set to highest
    kind = kindGrid.toGrid.sortr("count")[0]->kind
  end
    //echo(kind)

  try do
    if(kind == "Number") color = "item-numeric"
    else if(kind == "Bool") color = "item-boolean"
    else if(kind == "Str") color = "item-string"
  end catch ""
  return color
end


def ​

func:infoInfoForm ​

infoInfoForm(type) ​

Axon function


meta ​

deffunc:infoInfoForm
isfunc
liblib:finStackMobile
nameinfoInfoForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(type) => do
  text: ""
  d: finGetDiags().find(x=> x->name == type)
  propertyLangKeys:{
    avail: toLocale("finStackMobileExt::available"),
    committed: toLocale("finStackMobileExt::committed"),
    count: toLocale("finStackMobileExt::count"),
    count_0: toLocale("finStackMobileExt::psScavCount"),
    count_1: toLocale("finStackMobileExt::psMarkSweepCount"),
    free: toLocale("finStackMobileExt::free"),
    home: toLocale("finStackMobileExt::mobileHome"),
    homeDir: toLocale("finStackMobileExt::homeDir"),
    hostId: toLocale("finStackMobileExt::hostId"),
    hostname: toLocale("finStackMobileExt::hostname"),
    locale: toLocale("finStackMobileExt::locale"),
    max: toLocale("finStackMobileExt::maximum"),
    now: toLocale("finStackMobileExt::coreNow"),
    numProc: toLocale("finStackMobileExt::numProcessors"),
    os: toLocale("finStackMobileExt::os"),
    peak: toLocale("finStackMobileExt::peak"),
    percent: toLocale("finStackMobileExt::percent"),
    percentUp: toLocale("finStackMobileExt::percentUptime"),
    sysLoad: toLocale("finStackMobileExt::sysLoad"),
    time_0: toLocale("finStackMobileExt::psScavTime"),
    time_1: toLocale("finStackMobileExt::psMarkSweepTIme"),
    total: toLocale("finStackMobileExt::total"),
    totalTime: toLocale("finStackMobileExt::totalTIme"),
    uptime: toLocale("finStackMobileExt::finUptime"),
    used: toLocale("finStackMobileExt::used"),
    varDir: toLocale("finStackMobileExt::varDir"),
    version: toLocale("finStackMobileExt::finHostVersion"),
    vm: toLocale("finStackMobileExt::vm"),

  }

  d->attrs.each x=> do
    dis: if(x->name != "percent" or not x->dis.lower.contains("uptime")) propertyLangKeys[x->name] else propertyLangKeys["percentUp"]

    if(dis == null)
      dis = x->dis

    text = text + dis + " : " + x->val + "\n\n"
  end

  body: [
  {name: "text", editorType: "textarea", editable: false, defVal: text, height: 300},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": d->dis + " " + toLocale("finStackMobileExt::finInfo"),
  "name": "infoInfoForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:infoLintForm ​

infoLintForm() ​

Axon function


meta ​

deffunc:infoLintForm
isfunc
liblib:finStackMobile
nameinfoLintForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  body: [
    {name: "text", editorType: "table", dataProvider: "lint(null)", height: 300},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::debugMenuLintOut"),
  "name": "infoLintForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:infoReportForm ​

infoReportForm() ​

Axon function


meta ​

deffunc:infoReportForm
isfunc
liblib:finStackMobile
nameinfoReportForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  text: ""
  catLangKeys:{
    system: toLocale("finStackMobileExt::system"),
    proj: toLocale("finStackMobileExt::projects"),
    java: toLocale("finStackMobileExt::java"),
    cpu: toLocale("finStackMobileExt::cpu"),
    mem: toLocale("finStackMobileExt::physicalMem"),
    heap: toLocale("finStackMobileExt::javaHeap"),
    gc: toLocale("finStackMobileExt::garbageCollection"),
    disk: toLocale("finStackMobileExt::diskSpace"),
    fh: toLocale("finStackMobileExt::fileHandles"),
    threads: toLocale("finStackMobileExt::threads"),
    mod: toLocale("finStackMobileExt::sysMods")
  }

  propertyLangKeys:{
    avail: toLocale("finStackMobileExt::available"),
    committed: toLocale("finStackMobileExt::committed"),
    count: toLocale("finStackMobileExt::count"),
    count_0: toLocale("finStackMobileExt::psScavCount"),
    count_1: toLocale("finStackMobileExt::psMarkSweepCount"),
    free: toLocale("finStackMobileExt::free"),
    home: toLocale("finStackMobileExt::mobileHome"),
    homeDir: toLocale("finStackMobileExt::homeDir"),
    hostId: toLocale("finStackMobileExt::hostId"),
    hostname: toLocale("finStackMobileExt::hostname"),
    locale: toLocale("finStackMobileExt::locale"),
    max: toLocale("finStackMobileExt::maximum"),
    now: toLocale("finStackMobileExt::coreNow"),
    numProc: toLocale("finStackMobileExt::numProcessors"),
    os: toLocale("finStackMobileExt::os"),
    peak: toLocale("finStackMobileExt::peak"),
    percent: toLocale("finStackMobileExt::percent"),
    percentUp: toLocale("finStackMobileExt::percentUptime"),
    sysLoad: toLocale("finStackMobileExt::sysLoad"),
    time_0: toLocale("finStackMobileExt::psScavTime"),
    time_1: toLocale("finStackMobileExt::psMarkSweepTIme"),
    total: toLocale("finStackMobileExt::total"),
    totalTime: toLocale("finStackMobileExt::totalTIme"),
    uptime: toLocale("finStackMobileExt::finUptime"),
    used: toLocale("finStackMobileExt::used"),
    varDir: toLocale("finStackMobileExt::varDir"),
    version: toLocale("finStackMobileExt::finHostVersion"),
    vm: toLocale("finStackMobileExt::vm"),

  }

  finGetDiags().each x=> if(x->attrs.size > 0)
  do
    catDis: catLangKeys[x->name]

    if(catDis == null)
      catDis = x->dis

    text = text + "--- " + catDis + " ---\n"

    x->attrs.each y=>
    do
      propDis: propertyLangKeys[y->name]

      if(propDis == null)
        propDis = y->dis

      text = text + propDis + " : " + y->val + "\n"
    end

    text = text + "\n"
  end

  body: [
  {name: "text", editorType: "textarea", editable: false, defVal: text, height: 300},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::debugMenuReportDump"),
  "name": "infoReportForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:infoThreadsForm ​

infoThreadsForm() ​

Axon function


meta ​

deffunc:infoThreadsForm
isfunc
liblib:finStackMobile
nameinfoThreadsForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  text: threadDump().replace("CPU Time", toLocale("finStackMobileExt::cpuTime"))
                      .replace("Stack Traces", toLocale("finStackMobileExt::stackTraces"))
                      .replace("TIMED_WAITING", toLocale("finStackMobileExt::timedWaitingTrace"))
                      .replace("WAITING", toLocale("finStackMobileExt::waitingTrace"))
                      .replace("RUNNABLE", toLocale("finStackMobileExt::runnableTrace"))
  body: [
    {name: "text", editorType: "textarea", editable: false, defVal: text, height: 300},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::debugMenuThreadDump"),
    "name": "infoThreadsForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:infoViewerLibsForm ​

infoViewerLibsForm() ​

Axon function


meta ​

deffunc:infoViewerLibsForm
isfunc
liblib:finStackMobile
nameinfoViewerLibsForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  text: []

  count: 0
  secureReadAll(finVersion).keepCols(["dis","finVersion","mod"]).sort((x,y)=> x->dis <=> y->dis).each x=> do
    text = text.add({
      displayName: x->dis,
      appId: "info",
      ignoreSettings: marker(),
      action: "null",
      keepOpen:true,
      icon: "icon-preview",
      iconType: "class",
      ui: "html",
      minUiTarget: "phone",
      hasBadge: true,
      badgeValue: x->finVersion,
      badgeTooltip: x->mod,
      order: count })
    count = count + 1
  end

  text.addAll(finStackMenuBackButton(toLocale("finStackMobileExt::viewerLibs"), finInfoSettings("forMenu2"), "info")).toGrid
end


def ​

func:jobAppConfig ​

jobAppConfig() ​

Axon function


meta ​

deffunc:jobAppConfig
isfunc
liblib:finStackMobile
namejobAppConfig
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  readAll(job)
end


def ​

func:jobCreateForm ​

jobCreateForm(id: null, fail: null, folderPath: null, fromDbBuilder: false) ​

Axon function


meta ​

deffunc:jobCreateForm
isfunc
liblib:finStackMobile
namejobCreateForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id: null, fail: null, folderPath: null, fromDbBuilder: false) => do
  /*
    displays a form that prompts a user to select a job to edit
    the recursively calls this function to run the "else" code block
    primarily used with new DB Builder edit button
  */
  if(id == "select" or id.toStr.startsWith("folderPath")) do
    dataQuery: "readAll(job and not emptyFolder).sort(\"dis\")"

    if(folderPath != null and folderPath != "") do
      folder: id.toStr.replace("folderPath:jobs:", "").replace("--", "/").replace("__", " ")

      folder = cleanFolderPathName(folder)
      dataQuery = dataQuery + ".findAll(v => v.has(\"folderPath\") and v->folderPath != \"\" and cleanFolderPathName(v->folderPath).startsWith(\""+folder+"\"))"
    end

    body: [
      {
        name:"job", editorType:"combobox", prompt: toLocale("finStackMobileExt::selectJobToEdit"), labelField: "dis", selectedValueTags: "id",
        defIndex: 0,
        dataProvider: dataQuery, // "readAll(job).sort(\"dis\")"
      },

      { name:"cancelButton", editorType:"button", label:toLocale("finStackExt::cancel"), controlBar:true },
      { name:"commitButton", editorType:"button", label:toLocale("finStackExt::next"), controlBar:true }
    ]

    { "dis": toLocale("finStackMobileExt::editJob"),
      "name":"selectJob",
      "body":body.toJSON,
      "width": 450,
      "cancelButton": "\$cancelButton",
      "commitButton":"\$commitButton",
      "commitAction": "jobCreateForm(\$job, null, "+folderPath.toAxonCode+", "+fromDbBuilder+")",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end

  /*
    form to create or edit a job
  */
  else do
    days: [
      {a:toLocale("finStackMobileExt::schEventEvery"),b:"Every"},
      {a:toLocale("finStackMobileExt::jobMenuEveryDayAt"),b:"Everyday at"},
      {a:toLocale("finStackMobileExt::jobMenuOnWeekdays"),b:"On weekdays"},
      {a:toLocale("finStackMobileExt::jobMenuOnDays"),b:"On days"},
      {a:toLocale("finStackMobileExt::jobMenuOneTimeAt"),b:"One time at"}
    ]

    //create or get a job record
    if(id == null) job: {dis: "", job, jobExpr: "", jobSchedule: "every"}
    else job: readById(id)

    dayIndex: 0

    //determine what to pre-populate for when the job runs
    if(job->jobSchedule.contains("every"))
      dayIndex = 0
    else if(job->jobSchedule.contains("on")) do
      if(job->jobSchedule.contains(",")) dayIndex = 2
      else dayIndex = 3
    end
    else if(job->jobSchedule.contains("onetime"))
      dayIndex = 4
    else if(job->jobSchedule.contains("at"))
      dayIndex = 1

    //create form body
    body: [
      {
        name: "dis",
        editorType: "textinput",
        prompt: toLocale("finStackExt::gbName"),
        defVal: job->dis
      },

      {
        name: "func",
        editorType: "textarea",
        prompt: toLocale("finStackMobileExt::jobFormFunction"),
        height: 100,
        defVal: job->jobExpr
      },

      {
        name: "type",
        editorType: "combobox",
        prompt: toLocale("finStackMobileExt::jobFormSchedule"),
        dataProvider: days.toAxonCode,
        labelField: "a",
        selectedValueTags: "b",
        defIndex:dayIndex
      },

      { name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      { name: "applyButton",  editorType: "button", label: toLocale("finStackMobileExt::jobFormNext"), controlBar: true}
    ]

    //add error if invalid user input
    if(fail != null)
      body = body.insert(0, {name: "label", editorType: "label", text: toLocale("finStackMobileExt::provideJobName")})

    //determine folder path if any
    folderId: null
    defaultFolderPath: ""

    if(folderPath != null and folderPath.startsWith("@")) do
      folderId = folderPath
      folderRec: readById(parseRef(folderPath[1..-1]))

      if(folderRec.has("folderPath")) defaultFolderPath = folderRec->folderPath + "/" + folderRec->dis
      else defaultFolderPath = folderRec->dis
    end
    else if(folderPath != null) defaultFolderPath = folderPath

    dictStr: "{dis: \$dis, job, jobExpr: \$func, jobSchedule: \"at 00:00:00\"}"

    //add folderPath if any
    if(defaultFolderPath != "") do
      defaultFolderPath = cleanFolderPathName(defaultFolderPath)
      dictStr = dictStr[0..-2] + ", folderPath: " + defaultFolderPath.toAxonCode+"}"
    end

    if(id != null) action: "if(\$dis == \"\") jobCreateForm("+id.toAxonCode+", true) else jobEditForm(diff(readById(@"+id+"),"+dictStr+").commit->id, 2, \$type, 2, "+fromDbBuilder+", "+folderId+")"
    else action: "if(\$dis == \"\") jobCreateForm(null, true) else jobEditForm(diff(null,"+dictStr+",{add}).commit->id, 2, \$type, 2, "+fromDbBuilder+", "+folderId+")"

    {
      "dis": (if(id == null) toLocale("finStackMobileExt::jobFormCreateNewJob") else toLocale("finStackMobileExt::editJob")),
      "name": "jobCreateForm" + random(1..10000),
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": action,
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:jobDebugForm ​

jobDebugForm() ​

Axon function


meta ​

deffunc:jobDebugForm
isfunc
liblib:finStackMobile
namejobDebugForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  body: [
  {name: "text", editorType: "textarea", editable: false, defVal: jobDebug(), height: 300},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::jobMenuDebugDump"), //"Job Debug Dump",
  "name": "jobDebugForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:jobEditForm ​

jobEditForm(id, col, edit: true, ext: null, fromDbBuilder: false, emptyFolderId: null) ​

Axon function


meta ​

deffunc:jobEditForm
isfunc
liblib:finStackMobile
namejobEditForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, col, edit:true, ext:null, fromDbBuilder: false, emptyFolderId: null) => do
  compact: "window.app.ObtainMenu(null, 'null', 'job', "+ finJobSettings((if(ext == 2) "forMenu2" else "forMenu3"),id).toAxonCode +")"

  if (emptyFolderId != null)
    finHardDelete(emptyFolderId)

  if(col != 2)
  do
    cols: ["dis","jobExpr","jobSchedule","disabled","jobLastRuntime","jobLastStatus","jobLastTime"]
    nams: [
      toLocale("finStackMobileExt::reportColName"),
      toLocale("finStackMobileExt::jobFuncExtDis"),
      toLocale("finStackMobileExt::jobFormSchedule"),
      toLocale("finStackMobileExt::pointStatusDisabled"),
      toLocale("finStackMobileExt::jobMenuRunTime"),
      toLocale("finStackMobileExt::jobMenuLastStatus"),
      toLocale("finStackMobileExt::debugMenuTime")]
    job: readById(id)
    jobStatusDict: jobStatusAll().find(v => job.has("jobLastTime") and (v->started + v->runtime == job->jobLastTime))

    cformat: ()=> do
      if(job.has(col)) do
        db: job.trap(col)
        if(db.isNumber) db.toStr
        else if(db.isDateTime) db.format("MMM D, YYYY @ k:mmAA")
        else db
      end
      else toLocale("finStackMobileExt::siemensPointStatusDown")
    end

    body: [{name: "cancelButton", editorType: "button", label: (if(edit) toLocale("finStackExt::cancel") else toLocale("finStackExt::ok")), controlBar: true}]
    comact: "readById(@"+id+").diff({"+col+": \$text}).commit"

    if (edit)
    do
      if(col == "dis")
        body = body.add({name: "text", editorType: "textinput", defVal: cformat()})
      else if(col == "jobExpr")
        body = body.add({name: "text", editorType: "textarea", defVal: cformat(), height: 100})
      else
      do //schedule
        dind: jobParseTime("menu",job->jobSchedule)
        body = body.add({
          name: "text",
          editorType: "combobox",
          dataProvider: [
            {dis: toLocale("finStackMobileExt::schEventEvery"), val: "Every"},
            {dis: toLocale("finStackMobileExt::jobMenuEveryDayAt"), val: "Everyday at"},
            {dis: toLocale("finStackMobileExt::jobMenuOnWeekdays"), val: "On weekdays"},
            {dis: toLocale("finStackMobileExt::jobMenuOnDays"), val: "On days"},
            {dis: toLocale("finStackMobileExt::jobMenuOneTimeAt"), val: "One time at"}
          ].toAxonCode,
          labelField: "dis",
          selectedValueTags: "val",
          defIndex:dind
        })

        comact = "jobEditForm(@"+id+",2,\$text)"
        compact = "null"
      end

      body = body.add({name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true})
    end
    else
      body = body.add({name: "text", editorType: "label", text: col+": "+cformat()})

    if (col == "jobLastStatus" and jobStatusDict != null and jobStatusDict->jobStatus.endsWith("Err"))
      body = body.add({
        name: "textArea",
        editorType: "textarea",
        prompt: toLocale("finStackMobileExt::debug.log.errTrace"),
        height: 100,
        defVal: jobStatusDict->progressMsg
      })

    {
      "dis": (if(edit) toLocale("finStackMobileExt::editJob") else toLocale("finStackMobileExt::viewJob")) + " " + nams[cols.index(col)],
      "name": "jobEditForm",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": comact,
      "completeAction": compact,
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
  ////////////////////////
  else if(col == 2) do
    body: [
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    jobRec: readById(id)
    job: jobRec->jobSchedule

    if(fromDbBuilder and jobRec.has("folderPath")) do
      parentRefresh: "window.app.RefreshBuilderTreeNodeForId('@folderPath:jobs:"+jobRec->folderPath.split("/")[0..-2].concat("--").replace(" ", "__")+"');"
      folderRefresh: "window.app.RefreshBuilderTreeNodeForId('@folderPath:jobs:"+jobRec->folderPath.replace("/", "--").replace(" ", "__")+"');"
      gridRefresh: "window.app.RefreshBuilderGridAt(0, 'panel'); "

      compact = gridRefresh + parentRefresh + " setTimeout(function(){ "+folderRefresh+" }, 500);"
    end
    else if(fromDbBuilder) do
      parentRefresh: "window.app.RefreshBuilderTreeNodeForId('@folderPath:jobs:');"
      gridRefresh: "window.app.RefreshBuilderGridAt(0, 'panel'); "

      compact = gridRefresh + parentRefresh
    end

    /*
      determine what options to show based on
      how often the job should run
      (chosen by user in previous form  see: jobCreateForm
    */
    if(edit == "Every")
    do
      uni: ["ms","ec","in","hr","ay"].index(job[-2..-1])
      if(uni == null) uni = 2
      tmp: [
        {n:toLocale("finStackMobileExt::millisecond"),u:"ms"},
        {n:toLocale("finStackMobileExt::secondTime"),u:"sec"},
        {n:toLocale("finStackMobileExt::minuteTime"),u:"min"},
        {n:toLocale("finStackExt::hour"),u:"hr"},
        {n:toLocale("finStackExt::periodDay"),u:"day"}
      ]

      body = body.addAll([
        {
          name: "group",
          editorType: "group",
          horizontal,
          children: [
            {name: "one", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::time"), minVal: 1, defVal: try job.split(" ")[1].parseNumber.finRemoveUnits catch 1},
            {name: "two", editorType: "combobox", prompt: toLocale("finStackMobileExt::unit"), dataProvider: tmp.toAxonCode, labelField: "n", selectedValueTags: "u", defIndex: uni}
          ]
        }
      ])
      comact: "jobParseTime(\"every\",[\$one,\$two])"
    end
    else if(edit == "Everyday at")
    do
      try job = job.split(" ")[1].split(":").map(x=> x.parseInt) catch job = [12,0,0]
      if(job[0] == 0) job = job.set(0,12)
      if(job.size < 3) job = [12,0,0]
      body = body.addAll([
      {name: "group", editorType: "group", horizontal, children:[
        {name: "one", editorType: "numericstepper", prompt: toLocale("finStackExt::hour"), minVal: 1, maxVal: 12, defVal: (if(job[0] < 13) job[0] else job[0]-12)},
        {name: "two", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::minuteTime"), minVal: 0, maxVal: 59, defVal: job[1]},
        {name: "three", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::secondTime"), minVal: 0, maxVal: 59, defVal: job[2]},
        {name: "four", editorType: "combobox", dataProvider: "[\"am\",\"pm\"]", labelField: "val", selectedValueTags: "val", defIndex: (if(job[0] < 13) 0 else 1)}
      ]} ])
      comact: "jobParseTime(\"at\",[\$one,\$two,\$three,\$four])"
    end
    else if(edit == "On weekdays")
    do
      tmp: [
        {n:toLocale("finStackExt::dRuleSun"),u:"sun"},
        {n:toLocale("finStackExt::dRuleMon"),u:"mon"},
        {n:toLocale("finStackExt::dRuleTue"),u:"tue"},
        {n:toLocale("finStackExt::dRuleWed"),u:"wed"},
        {n:toLocale("finStackExt::dRuleThu"),u:"thu"},
        {n:toLocale("finStackExt::dRuleFri"),u:"fri"},
        {n:toLocale("finStackExt::dRuleSat"),u:"sat"}
      ]
      job = job.split(" ")
      try h: job[3].split(":").map(x=> x.parseInt)
      catch do
        job = ["","sun"]
        h: [12,0,0]
      end
      if(h[0] == 0) h = h.set(0,12)
      try uni: ["sun","mon","tue","wed","thu","fri","sat"].index(job[1][0..2]) catch uni: 0
      if(uni == null) uni = 0
      body = body.addAll([
      {name: "zero", editorType: "list", prompt: toLocale("finStackMobileExt::dRuleDays"), listType: "checkbox", dataProvider: tmp.toAxonCode, labelField: "n", selectedValueTags: "u", height: 150, defIndex: uni},
      {name: "group", editorType: "group", horizontal, children: [
        {name: "one", editorType: "numericstepper", prompt: toLocale("finStackExt::hour"), minVal: 1, maxVal: 12, defVal: (if(h[0] < 13) h[0] else h[0]-12)},
        {name: "two", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::minuteTime"), minVal: 0, maxVal: 59, defVal: h[1]},
        {name: "three", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::secondTime"), minVal: 0, maxVal: 59, defVal: h[2]},
        {name: "four", editorType: "combobox", dataProvider: "[\"am\",\"pm\"]", labelField: "val", selectedValueTags: "val", defIndex: (if(h[0] < 13) 0 else 1)}
      ]} ])
      comact: "jobParseTime(\"onwk\",[\$zero,\$one,\$two,\$three,\$four])"
    end
    else if(edit == "On days") do
      job = job.split(" ")
      try h: job[3].split(":").map(x=> x.parseInt)
      catch do
        job = ["","1,2,3"]
        h: [12,0,0]
      end
      if(job[1][0] < 48 or job[1][0] > 57) job = ["","1,2,3"]
      if(h[0] == 0) h = h.set(0,12)
      body = body.addAll([
      {name: "zero", editorType: "textinput", prompt: toLocale("finStackMobileExt::dRuleDays"), defVal: job[1]},
      {name: "group", editorType: "group", horizontal, children: [
        {name: "one", editorType: "numericstepper", prompt: toLocale("finStackExt::hour"), minVal: 1, maxVal: 12, defVal: (if(h[0] < 13) h[0] else h[0]-12)},
        {name: "two", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::minuteTime"), minVal: 0, maxVal: 59, defVal: h[1]},
        {name: "three", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::secondTime"), minVal: 0, maxVal: 59, defVal: h[2]},
        {name: "four", editorType: "combobox", dataProvider: "[\"am\",\"pm\"]", labelField: "val", selectedValueTags: "val", defIndex: (if(h[0] < 13) 0 else 1)}
      ]} ])
      comact: "jobParseTime(\"onday\",[\$zero,\$one,\$two,\$three,\$four])"
    end
    else if(edit == "One time at") do
      ru: x=> finRemoveUnits(x); n: now()
      job = job.split(" ")
      try do
        d: job[1][0..9].split("-").map(x=> x.parseInt)
        t: job[1][11..18].split(":").map(x=> x.parseInt)
      end catch do
        d: [n.year.ru, n.month.ru, n.day.ru]
        t: [n.hour.ru, n.minute.ru, n.second.ru]
      end
      tmp: [
        { val: "Jan", dis: toLocale("finStackExt::monthJan")},
        { val: "Feb", dis: toLocale("finStackExt::monthFeb")},
        { val: "Mar", dis: toLocale("finStackExt::monthMar")},
        { val: "Apr", dis: toLocale("finStackExt::monthApr")},
        { val: "May", dis: toLocale("finStackExt::monthMay")},
        { val: "Jun", dis: toLocale("finStackExt::monthJun")},
        { val: "Jul", dis: toLocale("finStackExt::monthJul")},
        { val: "Aug", dis: toLocale("finStackExt::monthAug")},
        { val: "Sep", dis: toLocale("finStackExt::monthSep")},
        { val: "Oct", dis: toLocale("finStackExt::monthOct")},
        { val: "Nov", dis: toLocale("finStackExt::monthNov")},
        { val: "Dec", dis: toLocale("finStackExt::monthDec")}
      ]

      body = body.addAll([
        {
          name: "g1",
          editorType: "group",
          horizontal,
          children: [
            {name: "y", editorType: "numericstepper", prompt: toLocale("finStackExt::periodYear"), minVal: n.year.ru, defVal: d[0]},
            {name: "mo", editorType: "combobox", prompt: toLocale("finStackExt::periodMonth"), dataProvider: tmp.toAxonCode, labelField: "dis", selectedValueTags: "val", defIndex: d[1] - 1},
            {name: "d", editorType: "numericstepper", prompt: toLocale("finStackExt::periodDay"), minVal: 1, maxVal: 31, defVal: d[2]}
          ]
        },
        {
          name: "g2",
          editorType: "group",
          horizontal,
          children: [
            {name: "h", editorType: "numericstepper", prompt: toLocale("finStackExt::hour"), minVal: 1, maxVal: 12, defVal: (if(t[0] < 13) t[0] else t[0]-12)},
            {name: "mi", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::minuteTime"), minVal: 0, maxVal: 59, defVal: t[1]},
            {name: "s", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::secondTime"), minVal: 0, maxVal: 59, defVal: t[2]},
            {name: "a", editorType: "combobox", dataProvider: "[\"am\",\"pm\"]", labelField: "val", selectedValueTags: "val", defIndex: (if(t[0] < 13) 0 else 1)}
          ]
        },

        {
          name: "t",
          editorType: "combobox",
          prompt: toLocale("finStackMobileExt::finTimezone"),
          dataProvider: tzdb().toRecList.toAxonCode,
          labelField: "name",
          selectedValueTags: "name",
          defIndex: 2
        }
      ])
      comact: "\"onetime \"+parseDateTime(\$y+\" \"+\$mo+\" \"+\$d+\" \"+\$h+\" \"+\$mi+\" \"+\$s+\" \"+\$a,\"YYYY MMM D k m s aa\",\$t).toStr"
    end

    {
      "dis": toLocale("finStackMobileExt::setSchedule") + ": "+edit,
      "name": "jobEditForm2",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "readById(@"+id+").diff({jobSchedule: "+comact+"}).commit",
      "completeAction": compact,
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:jobFinBackup ​

jobFinBackup() ​

Axon function


meta ​

deffunc:jobFinBackup
isfunc
liblib:finStackMobile
namejobFinBackup

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:jobParseTime ​

jobParseTime(type, params) ​

Axon function


meta ​

deffunc:jobParseTime
isfunc
liblib:finStackMobile
namejobParseTime
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(type, params) => do
  if(type == "every") do
    params = params.set(0,params[0].floor)
    //if(parseNumber(params[0]+params[1]) < 1min) "every 1min"
    if(parseNumber(params[0]+params[1]) < 15sec) "every 15sec"
    else "every "+params[0]+params[1]
  end
  else if(type == "at") do
    h: params[0]
    m: params[1]
    s: params[2]
    a: params[3]
    if(h == 12) h = 0
    if(a == "pm") h = h + 12
    if(h < 10) h = "0"+h
    if(m < 10) m = "0"+m
    if(s < 10) s = "0"+s
    "at "+h+":"+m+":"+s
  end
  else if(type == "onwk") do
    d: params[0].concat(",")
    if(d == "") d = "mon"
    "on "+d+" "+jobParseTime("at",params[1..-1])
  end
  else if(type == "onday") do
    d: params[0].replace(" ","")
    if(d == "") d = "1"
    "on "+d+" "+jobParseTime("at",params[1..-1])
  end
  else if(type == "menu") do
    "[\"Every\",\"Everyday at\",\"On weekdays\",\"On days\",\"One time at\"]"
    t: params[0..2]
    if(t == "eve") 0
    else if(t == "at ") 1
    else if(t == "on ") do
      if(params[3] >47 and params[3] <58) 3
      else 2
    end
    else if(t == "one") 4
    else 0
  end
end


def ​

func:jobRunForm ​

jobRunForm(id, par) ​

Axon function


meta ​

deffunc:jobRunForm
isfunc
liblib:finStackMobile
namejobRunForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,par) => do
  body: [
  {name: "comp", editorType: "poll", dataProvider: "jobStatus(\""+id+"\")[0]->progress", type: "progress", total:100, pollTime:1000},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::jobMenuJobProgress"),
  "name": "jobRunForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "",
  "completeAction": "window.app.ObtainMenu(null, 'null', 'job', "+ finJobSettings("forMenu3",par).toAxonCode +")",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:jobTrashForm ​

jobTrashForm(id: null, act: null) ​

Axon function


meta ​

deffunc:jobTrashForm
isfunc
liblib:finStackMobile
namejobTrashForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id: null, act: null) => do
  /*
    if the job tree or folder is selected when
    delete is clicked (only new dbBuilder)
  */
  if(id == null or id.toStr.startsWith("folderPath")) do
    dataQuery: "readAll((job or jobFolder) and not emptyFolder).sort(\"dis\")"

    if(id != null) do
      folderPath: id.toStr.replace("folderPath:jobs:", "").replace("--", "/").replace("__", " ")

      folderPath = cleanFolderPathName(folderPath)
      dataQuery = dataQuery + ".findAll(v => v.has(\"folderPath\") and not v->folderPath.isEmpty and cleanFolderPathName(v->folderPath).startsWith(\""+folderPath+"\"))"
    end

    body: [
      {
        name:"job",
        editorType:"combobox",
        prompt: toLocale("finStackMobileExt::slectJobToDelete"),
        labelField: "dis",
        selectedValueTags: "id",
        defIndex: 0,
        dataProvider: dataQuery
      },

      { name:"cancelButton", editorType:"button", label:toLocale("finStackExt::cancel"), controlBar:true },
      { name:"commitButton", editorType:"button", label:toLocale("finStackExt::next"), controlBar:true }
    ]

    { "dis": toLocale("finStackMobileExt::jobMenuTrashJob"),
      "name":"selectJob",
      "body":body.toJSON,
      "width": 450,
      "cancelButton": "\$cancelButton",
      "commitButton":"\$commitButton",
      "commitAction": "jobTrashForm(\$job, false)",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
  else do
    if(not id.isList) id = [id]
    id = id.map(x=> x.toStr.replace("@","").parseRef).unique

    msg: "'" + id.toRecList.map(x=> x.set("dis", x.dis)).toGrid.colToList("dis").concat("' & '") + "'"

    body: [
      {name: "label", editorType: "label", text: toLocale("finStackExt::folioFilesDeleteMsg").replace("{0}",msg)},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::no"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::yes"), controlBar: true}
    ]

    if(act == false) do
      jobRec: readById(id[0])
      folderPath: ""

      if(jobRec.has("folderPath")) do
        folderPath = cleanFolderPathName(jobRec->folderPath)

        if(readAll(job and folderPath != "").findAll(v => cleanFolderPathName(v->folderPath).startsWith(folderPath)).size > 1)
          folderPath = folderPath.replace("/", "--").replace(" ", "__")
        else
          folderPath = folderPath.split("/")[0..-2].concat("--").replace(" ", "__")
      end

      compAct: "window.app.RefreshBuilderGridAt(0, 'panel'); window.app.RefreshBuilderTreeNodeForId('@folderPath:jobs:"+folderPath+"')"
    end
    else compAct: "window.app.ObtainMenu(null, 'null', 'job', "+ finJobSettings("forMenu2").toAxonCode +")"

    { "dis": toLocale("finStackMobileExt::jobMenuTrashJob"), //Trash Job,
      "name": "jobTrashForm",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": id.toAxonCode+".toRecList.each x=> x.diff({trash: marker()}).commit",
      "completeAction": compAct,
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:manualOverrideArrayMenu ​

manualOverrideArrayMenu(pointId) ​

Axon function


meta ​

deffunc:manualOverrideArrayMenu
isfunc
liblib:finStackMobile
namemanualOverrideArrayMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(pointId) => do
//---Anon Funcs---//
  autoSub: (ptAry) => do
    currentUser: finGetCurrentUser()
    type: toLocale("finStackExt::auto")
    act: "finstack.eval('pointWrite("+pointId.toAxonCode+", null, "+ptAry->level+", \""+currentUser->username+"\")');"
    tt: toLocale("finStackMobileExt::runAutoOp")

    point: readById(pointId, false)
    actionName: ""

    if (point != null and point.has("actions")) do
      actionSplit: point->actions.split(",")

      if(ptAry->level == 1) actionName = finGetPtActionName(currentUser["actionAccessFilter"], pointId, "pointEmergencyAuto") //actionSplit.find(v => v.startsWith("pointEmergencyAuto"))
      else if(ptAry->level == 8) actionName = finGetPtActionName(currentUser["actionAccessFilter"], pointId, "pointAuto") //actionSplit.find(v => v.startsWith("pointAuto"))
      else actionName = null

    end else actionName = null

    if(ptAry->level == 1) do
      type = toLocale("finStackExt::emergencyAuto")
      tt = toLocale("finStackMobileExt::runEmergencyAutoOp")
    end else if(ptAry->level == 8) do
      type = toLocale("finStackExt::manualAuto")
      tt = toLocale("finStackMobileExt::runManualAutoOp")
    end

    if(actionName != null)
      act = "finstack.eval('try invoke("+pointId.toAxonCode+", "+actionName.toAxonCode+", {self:"+pointId.toAxonCode+"}) catch finFormAlertOk(\""+toLocale("finStackExt::regError")+"\", \""+ toLocale("finStackMobileExt::requiredActionFilterMissingOnUser").replace("{user}", finGetCurrentUser()->dis)+"\")');"

    if(not act.contains("invoke") and not currentUser.has("isAdmin") and ptAry->level != 1 and ptAry->level != 8)
      act = "finstack.eval('finFormAlertOk(\""+toLocale("finStackExt::regError")+"\", \""+ toLocale("finStackMobileExt::userRequiresAdminToWrite").replace("{user}", finGetCurrentUser()->dis)+"\")');"
    else if(currentUser.has("actionAccessFilter") and actionName == null) //not eval(currentUser->actionAccessFilter.replace("hvac_finCat", ptAry->level.toStr)))
      act = "finstack.eval('finFormAlertOk(\""+toLocale("finStackExt::regError")+"\", \""+ toLocale("finStackMobileExt::requiredActionFilterMissingOnUser").replace("{user}", finGetCurrentUser()->dis)+"\")');"

    act = act + " window.app.ObtainMenu(null, '{{targetRef}}', 'manualApp', {funcCall: \"manualOverrideArrayMenu("+pointId.toAxonCode+")\", hideBackButton: true, display: \"dis\", keepOpen: true});"

    return {
      startOpen:false,
      items:[
        {label: type, icon: "icon-gear", tooltip: tt, keepOpen: true, action: act}
      ]
    }.toJSON()
  end

//---Main---//
  mainMenu: {
    funcCall: "manualOverrideMenu({{targetRef}})",
    hideBackButton: true,
    display: "dis",
    keepOpen: true
  }

  pointRec: readById(pointId)
  arrayGrid: pointRec.pointWriteArray.findAll(v => v.has("val") or v->level == 8 or v->level == 1)

  arrayGrid.map(r => do
    menuDict: {
      dis: toLocale("finStackMobileExt::priorityLevel").replace("{{number}}", r->levelDis),
      order: r->level,
      action: null,
      keepOpen: true
    }

    if(r.has("val")) menuDict = menuDict.merge({submenu: autoSub(r), hasBadge: true, badgeValue: r->valDis})
    if(r.has("who")) menuDict = menuDict.set("body", "<h6 style=\"font-weight: normal\">"+r->who+"</h6>")

    r.merge(menuDict)
  end).addRows([{displayName: toLocale("finStackMobileExt::overridesTitle"), isHeader: true, isDivider: true, ignoreSettings, order: -9999}].addAll(finStackMenuBackButton(pointRec.dis, mainMenu, "overridesApp")))

end


def ​

func:manualOverrideMenu ​

manualOverrideMenu(targetRef) ​

Axon function


meta ​

deffunc:manualOverrideMenu
isfunc
liblib:finStackMobile
namemanualOverrideMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef) => do
//---Anon Funcs---//
  fixDis: (rec, kind) => do
    newDis: rec.dis
    reverseNav: []
    navList: read(navMeta)->equipPath.split("/").findAll(v => v != "")
    navPos: navList.eachWhile((x, i) => if(x == kind) i)

    navList[0..navPos].each x => reverseNav = reverseNav.insert(0, x)
    reverseNav.each x => newDis = newDis.replace(rec[x+"Ref"].readById.dis, "")

    return newDis
  end

//---Main---//
  curLocation: if(targetRef != null) finNavMetaWhoAmI(readById(targetRef)) else null
  pointList: readAll(point and (write8 or write1 or writeLevel == 8 or writeLevel == 1))
  autoSub: {
    items:[
      {
        label:toLocale("finStackMobileExt::autoAll"),
        action: "finstack.eval('finFormManualOverrideAuto("+targetRef.toAxonCode+", true, {level})')",
        icon: "icon-view-list",
        tooltip: toLocale("finStackMobileExt::autoAllTooltip"),
        keepOpen: true
      }, {
        label:toLocale("finStackMobileExt::autoSelected"),
        action: "finstack.eval('finFormManualOverrideAuto("+targetRef.toAxonCode+", false, {level})')",
        icon: "icon-checkmark",
        tooltip: toLocale("finStackMobileExt::autoSelectedTooltip"),
        keepOpen: true
      }
    ]
  }.toJSON()

  items:[
    {displayName: toLocale("finStackMobileExt::overridesTitle"), isHeader: true, isDivider: true, ignoreSettings, order: -9999},
    {displayName: toLocale("finStackExt::emergencyAuto"), ignoreSettings, order: -2, action: "null", keepOpen: true, icon: "icon-gear", iconType: "class", submenu: autoSub.replace("{level}", "1")},
    {displayName: toLocale("finStackExt::manualAuto"), ignoreSettings, order: -1, action: "null", keepOpen: true, icon: "icon-gear", iconType: "class", submenu: autoSub.replace("{level}", "8")},
    {displayName: if(curLocation == null) toLocale("finStackMobileExt::topLevelDis") else readById(targetRef).dis, isDivider: true, ignoreSettings, order: 0}
  ]

  //filter points
  if(curLocation != null) pointList = pointList.findAll(v => v[curLocation+"Ref"] == targetRef)

  //add points to menu
  pointList.each(r => do
    ptDict: {}
    writeVal: null
    writeNum: null
    act: "null"
    iconColor: ""
    iconName: ""
    htmlText: ""
    act = "window.app.ObtainMenu(null, '{{targetRef}}', 'manualApp', {funcCall: \"manualOverrideArrayMenu("+r->id.toAxonCode+")\", hideBackButton: true, display: \"dis\", keepOpen: true})"

    if(curLocation != null) ptDict = {dis: r.fixDis(curLocation), hasBadge:true, badgeType: "manual"}
    else ptDict = {dis: r.dis, hasBadge:true, badgeType: "manual"}

    //set badgeVal
    //set action
    if((r.has("write8") or (r.has("writeLevel") and r->writeLevel == 8)) and (r.has("write1") or (r.has("writeLevel") and r->writeLevel == 1))) do
      w1: if(r.has("write1")) r->write1 else r->writeVal
      w8: if(r.has("write8")) r->write8 else r->writeVal
      writeVal = if(r->kind == "Number") max(w8, w1) else r->writeVal
      writeNum = r->writeLevel
    end else if(r.has("write8") or (r.has("writeLevel") and r->writeLevel == 8)) do
      writeVal = if(r.has("write8")) r->write8 else r->writeVal
      writeNum = 8
    end else if(r.has("write1") or (r.has("writeLevel") and r->writeLevel == 1)) do
      writeVal = if(r.has("write1")) r->write1 else r->writeVal
      writeNum = 1
    end

    //set icon
    if(r.has("sensor")) iconName = "sm-sensor"
    else if(r.has("cmd")) iconName = "sm-command"
    else if(r.has("sp")) iconName = "sm-softpoint"

    //set icon color
    if(r->kind == "Bool") iconColor = "item-boolean"
    else if(r->kind == "Number") iconColor = "item-numeric"
    else if(r->kind == "Str" and r.has("enum")) iconColor = "item-enum"
    else iconColor = "item-string"

    //set under area (equip dis and who)
    htmlText = "<div style=\"display: inline-block\"><h6 style=\"font-weight: normal\">"+r->equipRef.readById.dis+"</h6>"+
               "<h6 style=\"font-weight: normal; text-transform: none;\">"+toLocale("finStackMobileExt::who")+": "+(if(r.has("writable")) r.pointWriteArray.find(v => v->level == writeNum)->who else toLocale("finStackMobileExt::pointNotWritable"))+" @ "+writeNum+"</h6></div>" //<h2>"+rec->who+"</h2>"

    ptDict = ptDict.merge({
      badgeValue: writeVal.toStr,
      action: act,
      iconClass: iconColor,
      icon: iconName,
      body: htmlText
    })

    items = items.add(ptDict)
  end)

  items
end


def ​

func:manualOverridesMainMenu ​

manualOverridesMainMenu() ​

Axon function


meta ​

deffunc:manualOverridesMainMenu
finStackMobileMenu✓
isfunc
liblib:finStackMobile
namemanualOverridesMainMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  menuSettings: {
    funcCall: "manualOverrideMenu({{targetRef}})",
    hideBackButton: true,
    display: "dis",
    keepOpen: true
  }

  [{
    displayName: toLocale("finStackMobileExt::overridesTitle").replace("— ","").replace(" —", ""),
    appId: "overridesApp",
    icon: "icon-scale",
    iconType: "class",
    hasBadge: false,
    level: 0,
    order: 7,
    keepOpen: true,
    classes:"tablet-only-hidden mobile-hidden",
    action: "window.app.ObtainMenu(null, '{{targetRef}}', 'overridesApp', " + menuSettings.toAxonCode + ")",
  }]
end


def ​

func:menuForButton ​

Axon function


meta ​

deffunc:menuForButton
finBuilderMenu✓
isfunc
liblib:finStackMobile
namemenuForButton
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
[
  {
    dis:toLocale("finStackExt::default"),
    name:"fin_menu_add_css_grey_button",
    menuOn:"elementTagName==\"button\"",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'view-default -error -success -focus',category:'button'}})"
  },

  {
    dis:toLocale("finStackMobileExt::focused"),
    name:"fin_menu_add_css_blue_button",
    menuOn:"elementTagName==\"button\"",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-error -success view-default focus',category:'button'}})"
  },

  {
    dis:toLocale("finStackExt::bLineSuccess"),
    name:"fin_menu_add_css_green_button",
    menuOn:"elementTagName==\"button\"",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-error -focus view-default success',category:'button'}})"
  },

  {
    dis:toLocale("finStackExt::regError"),
    name:"fin_menu_add_css_red_button",
    menuOn:"elementTagName==\"button\"",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-focus -success view-default error',category:'button'}})"
  }

]
end


def ​

func:menuForLabel ​

Axon function


meta ​

deffunc:menuForLabel
finBuilderMenu✓
isfunc
liblib:finStackMobile
namemenuForLabel
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
[
  {
    dis: toLocale("finStackMobileExt::emphasized"),
    name:"fin_menu_add_css_lpurple_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'view-superman-label -view-superman-value -status-.+',category:'label'}})"
  },

  {
    dis:toLocale("finStackExt::default"),
    name:"fin_menu_add_css_blue_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-superman-label view-superman-value',category:'label'}})"
  },

  {
    dis: toLocale("finStackExt::ok"),
    name:"fin_menu_add_css_green_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-ok',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::pointStatusOverridden"),
    name:"fin_menu_add_css_purple_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-overridden',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::unacked"),
    name:"fin_menu_add_css_darkgrey_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-unacked',category:'label'}]})"
  },

  {
    dis:toLocale("finStackExt::pointStatusAlarm"),
    name:"fin_menu_add_css_red_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-alarm',category:'label'}]})"
  },

  {
    dis:toLocale("finStackExt::fault"),
    name:"fin_menu_add_css_yellow_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-fault',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::pointStatusStale"),
    name:"fin_menu_add_css_lgrey_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-stale',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::pointStatusDown"),
    name:"fin_menu_add_css_cyan_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-down',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::pointStatusDisabled"),
    name:"fin_menu_add_css_grey_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-disabled',category:'label'}]})"
  },

  {
    dis:toLocale("finStackExt::valNull"),
    name:"fin_menu_add_css_lbrown_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::reportColStatus") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-status-.+',category:'label'},{class:'view-superman-value status-null',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::host.usr.light"),
    name:"fin_menu_add_css_lgttext_label",
    menuOn:"elementName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("fin5CoreExt::text") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'view-light-text',category:'label'},{class:'-view-light-dark -view-theme-text',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::host.usr.dark"),
    name:"fin_menu_add_css_darktext_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("fin5CoreExt::text") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-view-light-text -view-theme-text',category:'label'},{class:'view-light-dark',category:'label'}]})"
  },

  {
    dis:toLocale("finStackMobileExt::newUserTheme"),
    name:"fin_menu_add_css_themetext_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("fin5CoreExt::text") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:[{class:'-view-light-text -view-light-dark',category:'label'},{class:'view-theme-text',category:'label'}]})"}
  ,

  {
    dis:toLocale("finStackMobileExt::headerText"),
    name:"fin_menu_add_css_hdrtext_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'view-header-text',category:'label'}})"},

  {
    dis:toLocale("fin5CoreExt::round"),
    name:"fin_menu_add_css_shaperound_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::shape"),
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'round view-superman-value',category:'label'}})"
  },

  {
    dis:toLocale("fin5CoreExt::square"),
    name:"fin_menu_add_css_shapesquare_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackMobileExt::shape"),
    body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-round view-superman-value',category:'label'}})"
  },

  {
    dis:toLocale("fin5CoreExt::finIcons"),
    name:"fin_menu_add_css_addicons_label",
    menuOn:"elementTagName==\"label\" and (parentRef->layer or parentRef->parentRef->layer)",
    icon:"",
    folderPath:toLocale("j2FinToolsExt::style") + "/",
    body: "facade.sendNotification('executeExternal',{builderAction:'icons'})"
  },

]
end


def ​

func:menuForProgram ​

Axon function


meta ​

deffunc:menuForProgram
finBuilderMenu✓
isfunc
liblib:finStackMobile
namemenuForProgram
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  [
      //{dis:toLocale("finStackExt::delete"), name:"fin_menu_delete_prog", menuOn:"programName",icon:"",folderPath:"",
      //  body: "facade.sendNotification('executeExternal',{builderAction:'programUtils',type:'deleteProgram',filter:'program and name==\"' + this.model.nodeData.value.name + '\"'})"},
      //{dis:"Duplicate", name:"fin_menu_duplicate_prog", menuOn:"programName",icon:"",folderPath:"",
      //  body: "facade.sendNotification('executeExternal',{builderAction:'programUtils',filter: 'program and name==\"' + this.model.nodeData.value.name + '\"',type:'duplicateProgram'})"},
      {
        dis: "applyBatchTags",
        name: "fin_menu_batchtags_prog",
        menuOn: "program",
        icon: "",
        folderPath: "",
        body: "facade.sendNotification('executeExternal',{builderAction:'action:',extra:{type:'addTags',params:'program and name==\"' + this.model.nodeData.value.name + '\"'}})"
      },
  ]
end


def ​

func:menuForSuperman ​

Axon function


meta ​

deffunc:menuForSuperman
finBuilderMenu✓
isfunc
liblib:finStackMobile
namemenuForSuperman
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  [
    {
      dis: toLocale("finStackMobileExt::mini"),
      name: "fin_menu_add_css_sizemini_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small -view-medium -view-big view-mini',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::small"),
      name: "fin_menu_add_css_sizesmall_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'view-small -view-medium -view-big -view-mini',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::medium"),
      name: "fin_menu_add_css_sizemed_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small view-medium -view-big -view-mini',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::large"),
      name: "fin_menu_add_css_sizelge_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small -view-medium view-big -view-mini',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::sizeSet"),
      name: "fin_menu_add_css_sizeset_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'size-set',category:'smartlabel'}})"
    },

    {
      dis: toLocale("finStackMobileExt::miniLight"),
      name: "fin_menu_add_css_minilight_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small -view-medium -view-big view-mini -dark light no-shadow',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::miniDark"),
      name: "fin_menu_add_css_minidark_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small -view-medium -view-big view-mini -light dark no-shadow',category:'smartlabel'}})"
    },
    {
      dis: toLocale("finStackMobileExt::miniShadow"),
      name: "fin_menu_add_css_minishadow_sup",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/" + toLocale("finStackExt::view") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'cssClass',params:{class:'-view-small -view-medium -view-big -light -dark -no-shadow view-mini',category:'smartlabel'}})"
    },
    //{dis:"Tags", name:"fin_menu_add_css_valueOnly_sup", menuOn:"(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",icon:"",folderPath:"Style/",
    //  body: "facade.sendNotification('executeExternal',{builderAction:'smartLabelTags'})"},

    {
      dis: toLocale("finStackMobileExt::addValueOnly"),
      name: "fin_menu_add_valueOnly",
      menuOn: "not valueOnly and ((finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\"))",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setValueOnly', params:true})"
    },
    {
      dis: toLocale("finStackMobileExt::removeValueOnly"),
      name: "fin_menu_remove_valueOnly",
      menuOn: "valueOnly and ((finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\"))",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setValueOnly', params:false})"
    },
    {
      dis: toLocale("finStackMobileExt::addDisableActions"),
      name: "fin_menu_add_disable_actions",
      menuOn: "not disableActions and ((finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\"))",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setDisableActions', params:true})"
    },
    {
      dis: toLocale("finStackMobileExt::removeDisableActions"),
      name: "fin_menu_remove_disable_actions",
      menuOn: "disableActions and ((finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\"))",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setDisableActions', params:false})"
    },
    {
      dis: toLocale("finStackMobileExt::setCommandPoint"),
      name: "fin_menu_set_command_point",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setPointTag', params:'command'})"
    },
    {
      dis: toLocale("finStackMobileExt::setSensorPoint"),
      name: "fin_menu_set_sensor_point",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'setPointTag', params:'sensor'})"
    },
    {
      dis: toLocale("finStackMobileExt::statusBGColorsLabel"),
      name: "statusBGColors",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("j2FinToolsExt::style") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'statusBGColors'})"
    },

    //resize superman

    {
      dis: toLocale("finStackExt::default"),
      name: "fin_menu_sup_3",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("finStackMobileExt::resize") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'resizeSupLabels',labelType:''})"
    },
    {
      dis: toLocale("finStackMobileExt::small"),
      name: "fin_menu_sup_4",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("finStackMobileExt::resize") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'resizeSupLabels',labelType:'small'})"
    },
    {
      dis: toLocale("finStackMobileExt::medium"),
      name: "fin_menu_sup_5",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("finStackMobileExt::resize") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'resizeSupLabels',labelType:'medium'})"
    },
    {
      dis: toLocale("finStackMobileExt::large"),
      name: "fin_menu_sup_6",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("finStackMobileExt::resize") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'resizeSupLabels',labelType:'large'})"
    },
    {
      dis: toLocale("finStackMobileExt::xlarge"),
      name: "fin_menu_sup_7",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("finStackMobileExt::resize") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'resizeSupLabels',labelType:'xlarge'})"
    },

    //magic button
    {
      dis: toLocale("finStackMobileExt::bLineNew"),
      name: "fin_menu_sup_9",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/" + toLocale("fin5CoreExt::overviewBox") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'makeOverviewBox'})"
    },
    {
      dis: toLocale("finStackExt::coreEdit"),
      name: "fin_menu_sup_10",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\" and parentRef->parentRef->overviewBox) or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\" and parentRef->parentRef->parentRef->overviewBox) or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\" and parentRef->parentRef->parentRef->parentRef->overviewBox)  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\" and parentRef->parentRef->parentRef->parentRef->parentRef->overviewBox)",
      icon: "",
      folderPath:toLocale("finStackMobileExt::coreTools") + "/" + toLocale("fin5CoreExt::overviewBox") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'makeOverviewBox:edit'})"
    },
    {
      dis: toLocale("finStackExt::weatherMenuAdd"),
      name: "fin_menu_sup_11",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath:toLocale("finStackMobileExt::coreTools") + "/" + toLocale("fin5CoreExt::overviewBox") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'makeOverviewBox:add'})"
    },
    {
      dis: toLocale("fin5CoreExt::shortName"),
      name: "fin_menu_sup_13",
      menuOn: "(finModel and source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->finModel and parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\") or (parentRef->parentRef->finModel and parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")  or (parentRef->parentRef->parentRef->finModel and parentRef->parentRef->parentRef->source==\"/finPod/finGraphicResourcesExt/res/models/FIN Smart Label.f5m\")",
      icon: "",
      folderPath: toLocale("finStackMobileExt::coreTools") + "/",
      body: "facade.sendNotification('executeExternal',{builderAction:'magicFuncs',params:'editShortName'})"
    },

  ]
end


def ​

func:menuForVirtualPoint ​

Axon function


meta ​

deffunc:menuForVirtualPoint
finBuilderMenu✓
isfunc
liblib:finStackMobile
namemenuForVirtualPoint
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  m: [
      {
        dis:toLocale("finStackMobileExt::bLineNew"),
        name:"fin_menu_new_vp",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'form:addVirtualPointForm'})"
      },

      {
        dis:toLocale("finStackExt::coreEdit"),
        name:"fin_menu_edit_vp",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'editProperties',params:this.model.nodeData.value.id})"
      },

      {
        dis:toLocale("fin5CoreExt::curValFormat"),
        name:"fin_menu_format_vp",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'form:finGraphicCurValFormatForm',id: this.model.nodeData.value.id})"
      },

      {
        dis:toLocale("finStackExt::reportsDownload"),
        name:"fin_menu_download_vp",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'copyRecords:',params:'download',filter:'virtualPoint',showSelection:true})"
      },

      {
        dis:toLocale("finStackExt::gbApplyBatchTags"),
        name:"fin_menu_batchtags_vp",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'action:',extra:{type:'addTags',params:'virtualPoint',showSelection:true}})"
      },

      {
        dis: toLocale("finStackMobileExt::cleanVirtualPoints"),
        name:"fin_menu_clean_vps",
        menuOn:"virtualPoint",
        icon:"",
        folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'removeDupVps'})"
      },
  ]
  /*if(exts().find(x=> x->name=="siemensGraphicResources") == null)
  m = m.addAll([ //stuff that siemens shouldn't see
    {dis:"Clean Virtual Points", name:"fin_menu_clean_vps", menuOn:"virtualPoint",icon:"",folderPath:"",
        body: "facade.sendNotification('executeExternal',{builderAction:'removeDupVps'})"},
  ])*/
  return m
end


def ​

func:mobileViewRecordAdd ​

mobileViewRecordAdd(id, appid, back: null) ​

Axon function


meta ​

deffunc:mobileViewRecordAdd
isfunc
liblib:finStackMobile
namemobileViewRecordAdd
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,appid,back:null) => do
  rec: readById(id)
  x: [{nam: toLocale("finStackExt::string"), val: "mobileViewRecordString()"},{nam: toLocale("finStackExt::number"), val: "0"},{nam: toLocale("finStackExt::marker"), val: "marker()"},{nam: toLocale("finStackExt::boolean"), val: "true"},{nam: toLocale("finStackExt::folioQueryRef"), val: read(id)->id.toAxonCode},{nam: toLocale("finStackExt::folioQueryDateTime"), val: "0"}]

  body: [
  {name: "tname", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioQueryTagName"), defVal: ""},
  {name: "tval", editorType: "combobox", promtp: toLocale("finStackMobileExt::folioQueryTagType"), dataProvider: x.toAxonCode, labelField: "nam", selectedValueTags: "val"},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::folioQueryAddTagTo")+" "+rec.dis,
  "name": "mobileViewRecordAdd",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "readById(@"+id+").diff({\$tname: eval(\$tval)}).commit; mobileViewRecordEdit(@"+id+", \$tname, \""+appid+"\", "+back.toAxonCode+")",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:mobileViewRecordEdit ​

mobileViewRecordEdit(id, col, appid, back: null) ​

Axon function


meta ​

deffunc:mobileViewRecordEdit
isfunc
liblib:finStackMobile
namemobileViewRecordEdit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,col,appid,back:null) => do
  rec: readById(id)

  body: [
  {name: "tname", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioQueryTagName"), defVal: col},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  comact: "readById(@"+id+").diff({\$tname: \$tval}).commit"

  if(rec.trap(col).isNumber) body = body.add({name: "tval", editorType: "numericstepper", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), defVal: rec.trap(col)})
  else if(rec.trap(col).isStr and rec.trap(col).contains("\n")) body = body.add({name: "tval", editorType: "textarea", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), defVal: rec.trap(col)})
  else if(rec.trap(col).isStr) body = body.add({name: "tval", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), defVal: rec.trap(col)})
  else if(rec.trap(col).isBool) body = body.add({name: "tval", editorType: "combobox", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), dataProvider: "[{n:\"True\",v:true},{n:\"False\",v:false}]", labelField: "n", selectedValueTags: "v", defIndex: if(rec.trap(col)) 0 else 1})
  else if(rec.trap(col).isRef) body = body.add({name: "tval", editorType: "reference", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), defVal: rec.trap(col)})
  else if(rec.trap(col).debugType == "haystack::Marker") comact = "readById(@"+id+").diff({-"+col+", \$tname: marker()}).commit"
  else body = body.add({name: "tval", editorType: "textinput", prompt: toLocale("finStackMobileExt::folioQueryTagValue"), defVal: rec.trap(col)})

  compact: "window.app.ObtainMenu(null, 'null', '"+appid+"', "+ back.toAxonCode +")"

  { "dis": toLocale("finStackExt::coreEdit")+" "+rec.dis+": "+col,
  "name": "mobileViewRecordEdit",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": comact,
  "completeAction": compact,
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:mobileViewRecordInfo ​

mobileViewRecordInfo(id, appid, back: null) ​

Menu to view tags of a record. Supports creating, editing, and deleting tags. Can also delete record by clicking on id submenu.

Takes the id of a record, the appId, back button dict is optional. Leaving the back parameter as null or empty will cause clicking back to go to main menu.

settings2: { //this dict is used for the back button
  header: "asdf",
  funcCall: "finFolioMenu2()", //should be the function for the menu that its being called from
  display: "dis",
  hideBackButton: true }
settings: { //this dict is used for the action
  header: "asdf",
  funcCall: "mobileViewRecordInfo(@"+read(point)->id+",'asdftest',"+ settings2.toAxonCode.replace("\"","'") +")",
  display: "dis",
  hideBackButton: true }

Call from menu element using action:

action:  "window.app.ObtainMenu(null, 'null', 'folio'," + settings.toAxonCode +")"

meta ​

deffunc:mobileViewRecordInfo
isfunc
liblib:finStackMobile
namemobileViewRecordInfo
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, appid, back:null) => do
  rec: readById(id)
  nams: rec.names
  color: ""
  type1: ["","#A0A","#0A0","#0AA","#AAA"]
  type2: ["String","Number","Bool","Reference","DateTime"]
  nams.find((x,y)=> do if(x == "dis") nams = nams.remove(y); false end)
  nams.find((x,y)=> do if(x == "name") nams = nams.remove(y); false end)
  nams.find((x,y)=> do if(x == "navName") nams = nams.remove(y); false end)
  nams.find((x,y)=> do if(x == "id") nams = nams.remove(y); false end)
  nams.find((x,y)=> do if(x == "mod") nams = nams.remove(y); false end)
  count: 4

  ////////////settings dictionaries///////////////////

  settings: {
    header: rec.dis,
    funcCall: "mobileViewRecordInfo(@"+id+", '"+appid+"', "+replace(toAxonCode(back),"\"","'")+")",
    display: "dis",
    hideBackButton: true }
  pointVars: c1=>{
    items: [{
      label: toLocale("finStackExt::remove"),
      icon: "icon-trash",
      tooltip: toLocale("finStackMobileExt::toolTipRemoveThisTag"),
      action: "finstack.eval('readById(@"+id+").diff({-"+c1+"}).commit'); window.app.ObtainMenu(null, 'null','records',"+settings.toAxonCode+")",
      keepOpen: true },
      {
      label: toLocale("finStackExt::coreEdit"),
      icon: "icon-document-edit",
      tooltip: toLocale("finStackExt::folioMenuEditTags"),
      action: "finstack.eval('mobileViewRecordEdit(@"+id+",\""+c1+"\",\""+appid+"\","+ replace(toAxonCode(settings),"'","\\'") +")')",
      keepOpen: true }
  ]}.toJSON()
  idPointVars: (c1,aid)=>{
    items: [{
      label: toLocale("finStackMobileExt::folioQueryGoTo"),
      icon: "icon-arrow-right",
      tooltip: toLocale("finStackMobileExt::toolTipRemoveThisTag"),
      action: "window.app.ObtainMenu(null, 'null','records',"+ toAxonCode({header: rec.dis, display: "dis", hideBackButton: true,
        funcCall: "mobileViewRecordInfo(@"+aid+", '"+appid+"', "+replace(toAxonCode(back),"\"","'")+")" }) +")",
      keepOpen: true },
      {
      label: toLocale("finStackExt::remove"),
      icon: "icon-trash",
      tooltip: toLocale("finStackMobileExt::toolTipRemoveThisTag"),
      action: "finstack.eval('readById(@"+id+").diff({-"+c1+"}).commit'); window.app.ObtainMenu(null, 'null','records',"+settings.toAxonCode+")",
      keepOpen: true },
      {
      label: toLocale("finStackExt::coreEdit"),
      icon: "icon-document-edit",
      tooltip: toLocale("finStackExt::folioMenuEditTags"),
      action: "finstack.eval('mobileViewRecordEdit(@"+id+",\""+c1+"\",\""+appid+"\","+ replace(toAxonCode(settings),"'","\\'") +")')",
      keepOpen: true }
  ]}.toJSON()
  del: {
    items: [{
      label: toLocale("finStackExt::delete"),
      icon: "icon-trash",
      tooltip: toLocale("finStackMobileExt::toolTipDeleteRec"),
      action: "finstack.eval('readById(@"+id+").diff({trash: marker()}).commit'); window.app.ObtainMenu(null, 'null','records',"+settings.toAxonCode+")",
      keepOpen: true }
  ]}.toJSON()

  ////////////////beginning of mobile list////////////

  list: [{
    displayName: toLocale("finStackExt::coreRefresh"),
    appId: appid,
    ignoreSettings: marker(),
    action: "window.app.ObtainMenu(null, 'null','records',"+settings.toAxonCode+")",
    icon: "icon-retweet",
    iconType: "class",
    keepOpen:true,
    order: -1009 },
    {
    displayName: toLocale("finStackExt::addTags"),
    appId: appid,
    ignoreSettings: marker(),
    keepOpen: true,
    icon: "icon-plus",
    iconType: "class",
    action: "finstack.eval('mobileViewRecordAdd(@"+id+",\""+appid+"\","+ replace(toAxonCode(settings),"'","\\'") +")')",
    order: -1008 }
  ]

  //////////////dis, name, navName, id////////////////

  if(rec.has("dis")) list = list.add({
    displayName: rec->dis,
    appId: appid, ignoreSettings: marker(), action: "null",
    icon: "icon-tag", iconType: "class",
    keepOpen:true, order: 0,
    hasBadge: true, badgeValue: "dis",
    submenu: pointVars("dis") })
  if(rec.has("name")) list = list.add({
    displayName: rec->name,
    appId: appid, ignoreSettings: marker(), action: "null",
    icon: "icon-tag", iconType: "class",
    keepOpen:true, order: 1,
    hasBadge: true, badgeValue: "name",
    submenu: pointVars("name") })
  if(rec.has("navName")) list = list.add({
    displayName: rec->navName,
    appId: appid, ignoreSettings: marker(), action: "null",
    icon: "icon-tag", iconType: "class",
    keepOpen:true, order: 2,
    hasBadge: true, badgeValue: "navName",
    submenu: pointVars("navName") })
  if(rec.has("id")) list = list.add({
    displayName: rec->id,
    appId: appid, ignoreSettings: marker(), action: "null",
    icon: "icon-tag", iconType: "class", iconColor: "#0AA",
    keepOpen:true, order: 3,
    hasBadge: true, badgeValue: "id",
    submenu: del })

  ///////////////////marker tags//////////////////////

  list = list.add({
    displayName: toLocale("finStackExt::folioQueryMarkers"),
    isDivider: true,
    appId: appid,
    keepOpen: true,
    order: count,
    ignoreSettings: marker() })
  count = count + 1

  nams.findAll(x=> rec.trap(x).debugType == "haystack::Marker").each x=> do
    list = list.add({
      displayName: x,
      appId: appid, ignoreSettings: marker(),
      action: "null",
      icon: "icon-tag", iconType: "class", iconColor: "#AA0",
      hasBadge: true, badgeValue: "✓",
      badgeTooltip: "Marker", submenu: pointVars(x),
      keepOpen:true, order: count })
    count = count + 1
  end

  ////////////////property tags///////////////////////

  list = list.add({
    displayName: toLocale("finStackExt::properties"),
    isDivider: true,
    appId: appid,
    keepOpen: true,
    order: count,
    ignoreSettings: marker() })
  count = count + 1

  nams.findAll(x=> rec.trap(x).debugType != "haystack::Marker").each x=> do
    if(rec.trap(x).isNumber) color = "#A0A"
    else if(rec.trap(x).isBool) color = "#0A0"
    else if(rec.trap(x).isRef) color = "#0AA"
    else if(rec.trap(x).isDateTime or rec.trap(x).isDate or rec.trap(x).isTime) color = "#AAA"
    else color = ""
    list = list.add({
      displayName: x,
      appId: appid, ignoreSettings: marker(),
      action: "null",
      icon: "icon-tag", iconType: "class", iconColor: color,
      hasBadge: true, badgeValue: try (if(color=="#0AA") readById(rec.trap(x)).dis else rec.trap(x).toStr.finStrGet(0,50)) catch rec.trap(x).toStr.finStrGet(0,50),
      badgeTooltip: type2[type1.index(color)], submenu: if(color == "#0AA") idPointVars(x, rec.trap(x)) else pointVars(x),
      keepOpen:true, order: count })
    count = count + 1
  end

  list = list.add({
    displayName: "mod",
    appId: appid, ignoreSettings: marker(),
    action: "null",
    icon: "icon-tag", iconType: "class", iconColor: "#AAA",
    hasBadge: true, badgeValue: rec->mod.format("YYYY-MM-DD @ k:mm:ss AA"),
    badgeTooltip: "DateTime",
    keepOpen:true, order: count })
  count = count + 1

  if(back == null) appid = null
  list.addAll(finStackMenuBackButton(rec.dis, back, appid)).toGrid
end

//window.app.ObtainMenu(null,'null','records',{'header':'Folio Test','funcCall':'mobileViewRecordInfo()','display':'dis', 'hideBackButton':true})


def ​

func:mobileViewRecordString ​

mobileViewRecordString() ​

Axon function


meta ​

deffunc:mobileViewRecordString
isfunc
liblib:finStackMobile
namemobileViewRecordString
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  ""
end


def ​

func:nextActionProgramBlockTree ​

nextActionProgramBlockTree() ​

Axon function


meta ​

deffunc:nextActionProgramBlockTree
isfunc
liblib:finStackMobile
namenextActionProgramBlockTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  blocks: finBlocks()
  cats: blocks.colToList("category").unique

  cats = cats.map(x=>
  do
    disStr: if(x == null) toLocale("finStackMobileExt::miscellaneousAbbr") else x.split(" ").map(y=> y.capitalize).concat(" ")

    {
      dis: disStr,
      id: disStr.toTagName.parseRef,
      icon: "icon-folder",
      badge: {value: blocks.findAll(y=> y["category"] == x).size, type: "normal"},
      interactions: {
        select: {type: "axon", action: "selectActionProgramCatTree("+ toAxonCode(x) +")"}
      },
      isBranch,
      nextNode: {
        type: "axon",
        action: "nextActionProgramBlockTree2("+toAxonCode(x)+")"
      }
    }
  end)

  cats.toGrid.sort("dis");
end


def ​

func:nextActionProgramBlockTree2 ​

nextActionProgramBlockTree2(cat) ​

Axon function


meta ​

deffunc:nextActionProgramBlockTree2
isfunc
liblib:finStackMobile
namenextActionProgramBlockTree2
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(cat) => do
  finBlocks().findAll(x=> x["category"] == cat).map(x=> {
    id: x.dis.toTagName.parseRef,
    dis: x.dis,
    icon: "icon-view-thumb",
    interactions: {
      select: {type: "axon", action: "selectActionProgramCatTree2(\""+x->name+"\")"}
    }
  })
end


def ​

func:nextActionProgramTree ​

nextActionProgramTree(id) ​

Axon function


meta ​

deffunc:nextActionProgramTree
isfunc
liblib:finStackMobile
namenextActionProgramTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  title: ""
  title = toLocale("finStackMobileExt::tasksWithinProgram").replace("{programName}", id.readById.dis)

  panel2: {
    view: "default",
    default: true,
    viewId: "programsMainPanel",
    panelTitle: title,
    resolveWith: {
      type: "axon",
      action: "dbMakeDataGridPanel(\"controlTasks(@"+id+")\")"
    }
  }

  [
    {
      dis:toLocale("finStackMobileExt::variableBindings"),
      icon: "icon-link",
      interactions: {
        select: {type: "axon", action: "selectActionProgramVarBindingsTree(@"+id+")"}
      }
    },

    {
      id: id,
      dis:toLocale("finStackMobileExt::bLineTasks"),
      icon: "icon-list",
      isBranch,
      interactions: {
        select: {type: "axon", action: "{panels: ["+ panel2.toAxonCode +"]}"}
        //select: {type: "axon", action: "selectActionProgramTasksTree(@"+id+")"}
      },
      nextNode: {
        type: "axon",
        action: "nextActionProgramTree2({{args.selectedItem.id}})"
      }
    }
  ]
end


def ​

func:nextActionProgramTree2 ​

nextActionProgramTree2(id) ​

Axon function


meta ​

deffunc:nextActionProgramTree2
isfunc
liblib:finStackMobile
namenextActionProgramTree2
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  controlTasks(id).map(x=> do
    x.merge({
      interactions: {
        select: {type: "axon", action: "selectActionProgramTasksTree(@"+id+", @"+x->targetRef+")"}
      }
    })
  end)
end


def ​

func:priorityBadgeVal ​

priorityBadgeVal(item) ​

Axon function


meta ​

deffunc:priorityBadgeVal
isfunc
liblib:finStackMobile
namepriorityBadgeVal
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  if(item->val.isNumber and item->val.unit != null)
    return item->val.toStr
  else
    return item->val
end


def ​

func:scheduleBadgeTip ​

scheduleBadgeTip(item) ​

Axon function


meta ​

deffunc:scheduleBadgeTip
isfunc
liblib:finStackMobile
namescheduleBadgeTip
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  next: try item->nextTime.time catch null
  nextVal: if(item.has("nextVal")) item->nextVal else null
  curVal: scheduleBadgeVal(item).toStr
  tipStr: ""

  if(nextVal == null)
    return toLocale("finStackMobileExt::willRemainState").replace("{curState}", curVal)
  if(next == null)
    return toLocale("finStackMobileExt::noDateForScheduleTime")

/*----------------------------------------------------------------*/

  if(next.hour > 12)
    next = time(next.hour - 12hr, next.minute)  + " PM"
  else
    next = next + " AM"

  if(item->kind == "Bool")
    nextVal = scheduleBadgeVal(item, true)

  if(item->nextTime.date == today())
    tipStr = toLocale("finStackMobileExt::nextValToday").replace("{val}", nextVal.toStr).replace("{nextTime}", next.toStr)
  else
    tipStr = toLocale("finStackMobileExt::nextValDate").replace("{val}", nextVal.toStr).replace("{nextDate}", item->nextTime.date.toStr).replace("{nextTime}", next.toStr)

  return tipStr
end


def ​

func:scheduleBadgeType ​

scheduleBadgeType(item) ​

Axon function


meta ​

deffunc:scheduleBadgeType
isfunc
liblib:finStackMobile
namescheduleBadgeType
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  if(item->curStatus == "ok")
    "normal"
  else
    "error"
end


def ​

func:scheduleBadgeVal ​

scheduleBadgeVal(item, getOpp: false) ​

Axon function


meta ​

deffunc:scheduleBadgeVal
isfunc
liblib:finStackMobile
namescheduleBadgeVal
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item, getOpp:false) => do
  val: try item->curVal catch "Not Set"

  if(item->kind == "Bool") do
    if(val == "Not Set") val = false
    if(item.has("enum")) do
      if(val and getOpp) val = item->enum[0]
      else if(getOpp) val = item->enum[1]
      else if(val) val = item->enum[1]
      else val = item->enum[0]
    end else do
      if(val and getOpp) val = "OFF"
      else if(getOpp) val = "ON"
      else if(val) val = "ON"
      else val = "OFF"
    end
  end

  if(not val.isStr())
    val + ""
  else
    val
end


def ​

func:scheduleCreateNewCommit ​

scheduleCreateNewCommit(name, type, tz, defVal: null, enum: null, menuDict: null, returnScheduleRec: false) ​

Axon function


meta ​

deffunc:scheduleCreateNewCommit
isfunc
liblib:finStackMobile
namescheduleCreateNewCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(name, type, tz, defVal: null, enum: null, menuDict:null, returnScheduleRec: false) => do
  dictToCommit: {} //if(menuDict.has("folderPath") and menuDict->folderPath != "") {folderPath: menuDict->folderPath} else {}
  jsAction: "app.NavigateToApp(window.app.APP_NAMES.SCHEDULES, window.app.get('currentId'));"
  removeFolder: false

  if (menuDict.has("folderPath"))
  do
    if (menuDict->folderPath.isStr and not menuDict->folderPath.isEmpty and not menuDict->folderPath.startsWith("@"))
      dictToCommit = {folderPath: menuDict->folderPath}

    // empty folder
    else if (menuDict->folderPath.isRef or (menuDict->folderPath.isStr and menuDict->folderPath.startsWith("@")))
    do
      folderRec: menuDict->folderPath[1..-1].parseRef.readById
      folderPath: folderRec->dis

      if (folderRec.has("folderPath") and not folderRec->folderPath.isEmpty)
        folderPath = folderRec->folderPath + "/" + folderPath

      dictToCommit = {folderPath: folderPath}
      removeFolder = true
    end
  end

  //  get the timezone
  tzVal: ""
  if (tz["isDefault"] == null) do
    if (tz["userZone"] != null)
      tzVal = tz->userZone
    else
      tzVal = tz->fullName
  end else
    tzVal = removeMarker()

  if(defVal == null and enum == null)
    diff(null, dictToCommit.merge({dis: name, kind: type, tz: tzVal, schedule, scheduleGrid:[].toGrid, point, sp}), {add}).commit
  else if(defVal == null and enum != null)
    diff(null, dictToCommit.merge({dis: name, kind: "Str", tz: tzVal, enum: enum, schedule, scheduleGrid:[].toGrid, point, sp}), {add}).commit
  else if(defVal != null) do
    if(enum == null) do
      if(defVal == "Null") defVal = null
      diff(null, dictToCommit.merge({dis: name, kind: type, tz: tzVal, schedule, scheduleGrid: {
        "end": 00:00:00,
        "defaultEvent": marker(),
        "weekdays":"sun,mon,tue,wed,thu,fri,sat",
        "val": defVal,
        "start": 00:00:00,
      }.toGrid(), point, sp}), {add}).commit
    else
      diff(null, dictToCommit.merge({dis: name, kind: "Str", tz: tzVal, enum: enum, schedule, scheduleGrid: {
        "end": 00:00:00,
        "defaultEvent": marker(),
        "weekdays":"sun,mon,tue,wed,thu,fri,sat",
        "val": defVal,
        "start": 00:00:00,
      }.toGrid(), point, sp}), {add}).commit
  end

  // remove empty folder after new schedule is created
  if (removeFolder) folderPathDelete(parseRef(menuDict->folderPath[1..-1]))

  k: type
  if(k == "Enum") k = "Str"

  if(menuDict.has("folderPath")) do
    folderId: "@folderPath:schedules:"

    if(not menuDict->folderPath.isEmpty()) do
      parentId: folderId + cleanFolderPathName(menuDict->folderPath).split("/")[0..-2].concat("--").replace(" ", "__")
      folderId = folderId + cleanFolderPathName(menuDict->folderPath).replace("/", "--").replace(" ", "__")

      jsAction = "window.app.RefreshBuilderTreeNodeForId('"+parentId+"'); setTimeout(function() {window.app.RefreshBuilderTreeNodeForId('"+folderId+"');}, 500); window.app.RefreshBuilderGridAt(0, 'panel');"
    end

    else
      jsAction = "window.app.RefreshBuilderTreeNodeForId('"+folderId+"'); window.app.RefreshBuilderGridAt(0, 'panel');"
  end

  if(returnScheduleRec) do
    return read(schedule and dis == name and kind == k)
  end
  else if(eval("secureReadAll(point and schedulable and kind == " + type.toAxonCode + ")").size <= 250) do
    scheduleID: read(schedule and dis == name and kind == k)->id

    scheduleFindPoints(scheduleID, type, menuDict)
  end else
    finStackMenuOkForm(toLocale("finStackMobileExt::scheduleCreated"), toLocale("finStackMobileExt::scheduleCreatedAndPointsSkipped").replace("{name}", name), jsAction)
end


def ​

func:scheduleCreateNewDefVal ​

scheduleCreateNewDefVal(name, type, tz, defVals, menuDict) ​

Axon function


meta ​

deffunc:scheduleCreateNewDefVal
isfunc
liblib:finStackMobile
namescheduleCreateNewDefVal
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(name, type, tz, defVals, menuDict) => do
  if(defVals or type == "Enum") do
    formTitle: toLocale("finStackMobileExt::scheduleSetDefault").replace("{name}", name)
    boolUI: {
      name: "defaultVal", prompt: toLocale("finStackMobileExt::scheduleSetDefault") + ":",
      editorType: "combobox",
      dataProvider: [{dis: toLocale("finStackExt::valTrue"), val:true},{dis: toLocale("finStackExt::valFalse"), val:false},{dis: toLocale("finStackExt::valNull"), val: "Null"}].toAxonCode,
      labelField: "dis",
      selectedValueTags: "val"
    }
    numberUI: {name: "defaultVal", prompt: toLocale("finStackMobileExt::scheduleSetDefault") + ":", editorType: "numericstepper"}
    stringUI: {name: "defaultVal", prompt: toLocale("finStackMobileExt::scheduleSetDefault") + ":", editorType: "textinput"}

    action: "scheduleCreateNewCommit(" + name.toAxonCode + ", " + type.toAxonCode + ", " + tz.toAxonCode + ", \$defaultVal, null, " + menuDict.toAxonCode + ")"

    enumUI: [{
      name: "enumSet",
      prompt: toLocale("finStackMobileExt::useEnumSet"),
      editorType: "combobox",
      dataProvider: "readAllTagVals(enum, \"enum\").map(x=> if(x->val.size > 100) {dis: x->val[0..99]+\"...\", val: x->val} else {dis: x->val, val: x->val})",
      labelField: "dis",
      selectedValueTags: "val"
    }]

    if(defVals and type == "Enum") do
      enumUI = enumUI.add({name: "defaultVal", prompt: toLocale("finStackMobileExt::scheduleSetDefault") + ":", editorType: "combobox",
        dataProvider: "\$enumSet.split(\",\").findAll(v => not v.isEmpty)", labelField: "val", selectedValueTags: "val"})
      action = "scheduleCreateNewCommit(" + name.toAxonCode + ", " + type.toAxonCode + ", " + tz.toAxonCode + ", \$defaultVal, \$enumSet, " + menuDict.toAxonCode + ")"
    end else if(type == "Enum") do
      formTitle = toLocale("finStackMobileExt::useEnumSet").replace("{name}", name)
      action = "scheduleCreateNewCommit(" + name.toAxonCode + ", " + type.toAxonCode + ", " + tz.toAxonCode + ", null, \$enumSet, " + menuDict.toAxonCode + ")"
    end

    body: [
      { name:"cancelButton", editorType:"button", label:toLocale("finStackExt::cancel"), controlBar:true },
      { name:"commitButton", editorType:"button", label:toLocale("finStackExt::ok"), controlBar:true }
    ]

    if(type == "Bool")
      body = body.add(boolUI)
    else if(type == "Number")
      body = body.add(numberUI)
    else if(type == "Str")
      body = body.add(stringUI)
    else if(type == "Enum") do
      body = body.addAll(enumUI)
    end

    { "dis":formTitle,
      "name":"scheduleCreateNewDefVal",
      "body":body.toJSON,
      "width": 450,
      "cancelButton": "\$cancelButton",
      "commitButton":"\$commitButton",
      "commitAction": action,
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end else
    scheduleCreateNewCommit(name, type, tz, null, null, menuDict)
end


def ​

func:scheduleCreateNewForm ​

scheduleCreateNewForm(targetRef: null, fromPrevious: false, previousChoice: null, folderPath: null) ​

Axon function


meta ​

deffunc:scheduleCreateNewForm
isfunc
liblib:finStackMobile
namescheduleCreateNewForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef:null, fromPrevious: false, previousChoice: null, folderPath: null) => do
  scheduleTypes:[{dis: toLocale("finStackExt::boolean"), val: "Bool"},{dis: toLocale("finStackExt::number"), val: "Number"},{dis: toLocale("finStackExt::string"), val: "Str"},{dis: toLocale("finStackExt::enum"), val: "Enum"}]
  selectedIndex: 0

  currentUser: finGetCurrentUser()
  currentUsrZone: currentUser["tz"]
  currentTimeZoneName: now().tz
  allTimezones: tzdb().toRecList
  if (currentUsrZone == null and currentUser["userProtoRef"] != null)
    currentUsrZone = currentUser->userProtoRef.userReadById->tz
  else
    currentUsrZone = now().tz

  //  find the full-name of the user zone
  userZone: allTimezones.find r => r->fullName == currentUsrZone or r->name == currentUsrZone

  //. and for the current zone
  currentZoneFullName: allTimezones.find r => r->fullName == currentTimeZoneName or r->name == currentTimeZoneName

  //  add the default ones
  allTimezones = allTimezones.insert(0, {fullName: "System (Default - " +currentZoneFullName->fullName+ ")", isDefault: true})

  //  check and add user-zone
  if (userZone != null)
    allTimezones = allTimezones.insert(1, {fullName: "User (" +userZone->fullName+ ")", userZone: userZone->fullName})

  body: [
    { name:"cancelButton", editorType:"button", label:toLocale("finStackExt::cancel"), controlBar:true },
    { name:"commitButton", editorType:"button", label:toLocale("finStackExt::ok"), controlBar:true }
  ]

  if(previousChoice != null) do
    selectedIndex = eachWhile(scheduleTypes) (x,i) => if(x->val == previousChoice) i
    body = body.add({name: "nameRequiredLabel", editorType: "label", text: toLocale("finStackMobileExt::includeNameForSchedule")})
  end

  body = body.addAll([
    {
      name:"scheduleName",
      prompt: toLocale("finStackMobileExt::pointsScheduleName"),
      editorType: "textinput",
    },

    {
      name:"scheduleType",
      prompt: toLocale("finStackMobileExt::scheduleType"),
      editorType: "combobox",
      dataProvider: scheduleTypes.toAxonCode,
      labelField: "dis",
      selectedValueTags: "val",
      defIndex: selectedIndex
    },

    {
      name: "scheduleTz",
      prompt: toLocale("finStackMobileExt::finTimezone"),
      editorType: "combobox",
      dataProvider: allTimezones.toAxonCode,
      labelField: "fullName",
      selectedValueTags: "fullName,isDefault,userZone",
      defIndex: 0
    },

    {
      name: "defaultVal",
      label: toLocale("finStackMobileExt::scheduleSetDefault"),
      editorType: "checkbox",
      defVal: true
    },
  ])

  if(targetRef == null)
    targetRef = ""

  { "dis":toLocale("finStackMobileExt::scheduleMenuCreateNewTitle"),
    "name":if(previousChoice == null) "createNewSchedule" else "createNewSchedule" + random(1..10000),
    "body":body.toJSON,
    "width": 450,
    "cancelButton": "\$cancelButton",
    "commitButton":"\$commitButton",
    "commitAction": "if(\$scheduleName.isEmpty()) scheduleCreateNewForm("+ targetRef.toAxonCode + "," + fromPrevious + ",\$scheduleType, "+folderPath.toAxonCode+") " +
                    "else scheduleCreateNewDefVal(\$scheduleName, \$scheduleType, \$scheduleTz, \$defaultVal, {target: " + targetRef.toAxonCode + ", fromAll: " + fromPrevious + ", folderPath: "+folderPath.toAxonCode+"})",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:scheduleDisplay ​

scheduleDisplay(item, targetRef) ​

Axon function


meta ​

deffunc:scheduleDisplay
isfunc
liblib:finStackMobile
namescheduleDisplay
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item, targetRef) => do
  numPoints: scheduleIconTip(item, targetRef).replace("points", "").replace("equips", "").trim

  if(targetRef != null)
    item.dis + " (" + numPoints + "/" + scheduleIconTip(item, null).replace("points", "").replace("equips", "").trim + ")"
  else
    item.dis + " (" + numPoints + ")"
end


def ​

func:scheduleFindPoints ​

scheduleFindPoints(id, type: null, menuDict: null) ​

Axon function


meta ​

deffunc:scheduleFindPoints
distoLocale("finStackMobileExt::addPointsToSchedule")
formOnschedule
isfunc
liblib:finStackMobile
namescheduleFindPoints
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, type: null, menuDict:null) => do
  isEnum: false

  if(type == null and readById(id)->kind == "Str" and readById(id).has("enum")) type = "Enum"

  if(type == null)
    type = readById(id)->kind
  else if(type == "Enum") do
    type = "Str"
    isEnum = true
  end

  q:"point and (schedulable or bacnetScheduleRead or bacnetScheduleWrite) and kind == " + type.toAxonCode

  if(isEnum)
    q = q + " and enum"
  else if(type == "Str")
    q = q + " and not enum"

  body: [
    { name: "points",
      editorType: "list",
      listType: "checkbox",
      prompt: toLocale("finStackMobileExt::choosePointsForSchedule"),
      dataProvider: "secureReadAll(" + q + ").sort((a,b) => a.dis<=>b.dis).map(x=> if(x.has(\"scheduleRef\")) x.set(\"dis\", x.dis+\" (\"+ x->scheduleRef.readById(false).dis +\")\") else x)",
      labelField: "dis",
      height: 250,
      selectedValueTags: "id"
    },

    { name:"cancelButton", editorType:"button", label:toLocale("finStackExt::cancel"), controlBar:true},
    { name:"commitButton", editorType:"button", label:toLocale("finStackExt::ok"), controlBar:true }
  ]

  { "dis":toLocale("finStackMobileExt::addPointsToSchedule"),
    "name":"assignPoints",
    "body":body.toJSON,
    "width": 450,
    "cancelButton": "\$cancelButton",
    "commitButton":"\$commitButton",
    "commitAction": "scheduleFindPointsCommit(\$points, " + id.toAxonCode + ", " + menuDict.toAxonCode + ")",
    "completeAction": "window.app.RefreshCurrentAppData();",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:scheduleFindPointsCommit ​

scheduleFindPointsCommit(pointList, scheduleID, menuDict: null) ​

Axon function


meta ​

deffunc:scheduleFindPointsCommit
isfunc
liblib:finStackMobile
namescheduleFindPointsCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(pointList, scheduleID, menuDict:null) => do
  schedule: readById(scheduleID)
  action: ""
  title: toLocale("finStackMobileExt::pointsAdded")
  msg: toLocale("finStackMobileExt::pointsHaveBeenAdded").replace("{name}", schedule.dis)

  pointList.each point =>
    readById(point).diff({scheduleRef: scheduleID}).commit

  if(menuDict != null) do
    //if there is folderPath property, assume from new db builder
    if(menuDict.has("folderPath")) do
      folderId: "@folderPath:schedules:" //root

      //if new schedule is to be in a folder
      if(not menuDict->folderPath.isEmpty()) do
        parentId: folderId + cleanFolderPathName(menuDict->folderPath).split("/")[0..-2].concat("--").replace(" ", "__")
        folderId = folderId + cleanFolderPathName(menuDict->folderPath).replace("/", "--").replace(" ", "__")

        action = "window.app.RefreshBuilderTreeNodeForId('"+parentId+"'); setTimeout(function() {window.app.RefreshBuilderTreeNodeForId('"+folderId+"');}, 500); window.app.RefreshBuilderGridAt(0, 'panel');"
      end

      //no folder
      else action = "window.app.RefreshBuilderTreeNodeForId('"+folderId+"'); window.app.RefreshBuilderGridAt(0, 'panel');"
    end

    else action = "app.NavigateToApp(window.app.APP_NAMES.SCHEDULES, window.app.get('currentId'));"

    title = toLocale("finStackMobileExt::scheduleCreated")
    msg = toLocale("finStackMobileExt::createdSuccess").replace("{name}", schedule.dis)
  end

  finStackMenuOkForm(title, msg, action)
end


def ​

func:scheduleGetRefs ​

scheduleGetRefs(targetRef) ​

Axon function


meta ​

deffunc:scheduleGetRefs
isfunc
liblib:finStackMobile
namescheduleGetRefs
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef) => do
  if (targetRef == null)
    return readAll(schedule).toRecList

  foundRefs: []

  finNavChildren("equip", targetRef, null, false, true).each navItem => do
    if(navItem.has("scheduleRef") and not foundRefs.contains(navItem->scheduleRef))
      foundRefs = foundRefs.add(navItem->scheduleRef)

    if(not navItem.has("point") and not navItem.has("taskFolder"))
      foundRefs = foundRefs.addAll(scheduleGetRefs(navItem->id))
  end

  return foundRefs.unique.map(r => try if(r.isDict) r else readById(r) catch r).findAll(r=> try do if(not r.isDict) readById(r); true end catch false)
end


def ​

func:scheduleIconTip ​

scheduleIconTip(curSchedule, targetRef: null) ​

Axon function


meta ​

deffunc:scheduleIconTip
isfunc
liblib:finStackMobile
namescheduleIconTip
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(curSchedule, targetRef: null) => do
  text:""
  try do
    refs: eval("secureReadAll(scheduleRef == " + curSchedule->id.toAxonCode + ")")

    if(targetRef != null) do
      levels: read(navMeta)->equipPath.split("/")
      parentRefType: levels.find(v => readById(targetRef).has(v)) + "Ref"

      refs = refs.finGridFilter(parseFilter(parentRefType + " == " + targetRef.toAxonCode))
    end

    text = toLocale("finStackMobileExt::scheduleMenuNumberOfPointsIconTip").replace("{0}", refs.finGridFilter(point).size.toStr)

    if(refs.finGridFilter(equip).size > 0)
      text = text  + "\n" + oLocale("finStackMobileExt::scheduleMenuNumberOfEquipsIconTip").replace("{0}", refs.finGridFilter(equip).size.toStr)
  end catch
    text = toLocale("finStackMobileExt::scheduleMenuNumberOfPointsIconTip").replace("{0}", "0")

  return text
end


def ​

func:scheduleMenu ​

scheduleMenu(targetRef, fromShowAll: false) ​

Axon function


meta ​

deffunc:scheduleMenu
isfunc
liblib:finStackMobile
namescheduleMenu
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef,fromShowAll: false) => do
  projName: context()->projName

//---menu item vars---//
  scheduleSubmenu:{
    startOpen: false,
    items:[
      {
        label: toLocale("finStackExt::coreEdit"),
        //keepOpen: true,
        icon: "icon-document-edit",
        tooltip: toLocale("finStackMobileExt::scheduleMenuEditTip"),
        //link: "null"
      },

      {
        label: toLocale("finStackMobileExt::coreTools"),
        keepOpen: true,
        icon: "icon-gear",
        tooltip: toLocale("finStackMobileExt::scheduleMenuToolsTip"),
        action: "null" //scheduleToolTreeForm
      },

      {
        label: toLocale("finStackExt::delete"),
        keepOpen: true,
        icon: "icon-trash",
        tooltip: toLocale("finStackMobileExt::scheduleMenuDeleteTip"),
        style: "background: red",
        action: "null" //scheduleToolTreeForm
      }
    ]
  }

  mainDivider: {
    displayName: toLocale("finStackExt::rightMenuSchedulesTitle"),
    order: -1000,
    isDivider:true,
    ignoreSettings,
    header
  }

  schedules: secureReadAll(schedule).map(r =>
    r.set("submenu", scheduleSubmenu.set("items", scheduleSubmenu->items.map(x =>
      if(x->label == toLocale("finStackMobileExt::coreTools")) x.set("action", "finstack.eval('scheduleToolTreeForm(" + r->id.toAxonCode + ")')")
      else if(x->label == toLocale("finStackExt::coreEdit")) x.set("action", "window.app.OpenScheduleWithIdAndRef('" + r->id.toAxonCode + "', '" + targetRef.toAxonCode + "')")
      else x.set("action", "finstack.eval('scheduleConfirmDeleteForm(" + r->id.toAxonCode + ", " + targetRef.toAxonCode + ", " + fromShowAll + ")')")
    )).toJSON()
  ))
  scheduleCount: schedules.size

//---menu construction---//
  menuItems: [
    {displayName: toLocale("finStackMobileExt::schTitle"), isHeader: true, isDivider: true, ignoreSettings, order: -9999},
    {
      displayName: toLocale("finStackMobileExt::scheduleMenuCreateNewTitle"),
      appId: "newSchedule",
      icon: "icon-plus",
      iconType: "class",
      level: 0,
      order: -1010,
      ignoreSettings,
      action: "finstack.eval('scheduleCreateNewForm(" + targetRef.toAxonCode + ", " + fromShowAll +" )')",
      keepOpen: true
    },

    {
      displayName: if(targetRef == null) toLocale("finStackMobileExt::scheduleMenuAllTitle") else readById(targetRef).dis,
      isDivider: "true",
      order: -1000, //-1011,
      ignoreSettings,
      header
    },

    {
      displayName: toLocale("finStackExt::coreRefresh"),
      appId: "refreshVars",
      ignoreSettings,
      action: "window.app.ObtainMenu(null, '{{targetRef}}','schedules', " + scheduleMenuSettings(targetRef, fromShowAll).toAxonCode + ")",
      icon: "icon-retweet",
      iconType: "class",
      keepOpen:true,
      order: -1009
    },

    {
      displayName: toLocale("finStackMobileExt::scheduleMenuLegacyTitle"),
      link: "",
      appId: "oldSchedules",
      icon: "icomoon-schedule",
      iconType: "class",
      iconTooltip: toLocale("finStackMobileExt::scheduleMenuLegacyIconTip"),
      action: ["window.app.LoadApplication('/finLegacyProj/" + projName + "/#schedules');", "window.top.app.set('viewAppId', 'schedules');"].concat("\n"),
      level: 0,
      order: -1008,
      ui: "flash",
      keepOpen: true,
      classes:"mobile-hidden",
      ignoreSettings
    },

    {
      displayName: toLocale("finStackExt::coreMisc"),
      icon: "icon-box",
      iconType: "class",
      ignoreSettings,
      action: "null",
      order: -1005,
      keepOpen: true,
      submenu: { items: [{
        label: toLocale("finStackMobileExt::coreBackup"),
        icon: "icon-download",
        tooltip: toLocale("finStackMobileExt::scheduleMenuBackupTip"),
        action: "finstack.eval('finFolioDownloadForm(\"schedule\",\"schedule\")')",
        keepOpen: true
       }, {
        label: toLocale("finStackMobileExt::coreRestore"),
        icon: "icon-upload",
        tooltip: toLocale("finStackMobileExt::scheduleMenuRestoreTip"),
        action: "finstack.eval('finFolioUploadForm(null,null,\"schedule\")')",
        keepOpen: true
       }, {
        label: toLocale("finStackMobileExt::coreOrganize"),
        icon: "icon-folder-open",
        tooltip: toLocale("finStackMobileExt::scheduleMenuOrganizeTip"),
        action: "finstack.eval('finOrganizeFolderpathForm(\"schedule\")')",
        keepOpen: true
       }]
      }.toJSON
    }
  ]

  if(targetRef == null) do
   menuItems = menuItems.addAll(schedules.toRecList())

   if(fromShowAll) menuItems = menuItems.addAll(finStackMenuBackButton(toLocale("finStackExt::rightMenuSchedulesTitle"), scheduleMenuSettings(targetRef), "targetSchedules"))
   //else menuItems = menuItems.add(mainDivider)

  end else do
    scheduleRefs: scheduleGetRefs(targetRef)

    menuItems = menuItems.add({
      displayName: toLocale("finStackMobileExt::scheduleMenuViewAllTitle"),
      appId: "allSchedules",
      icon: "icomoon-schedule",
      iconType: "class",
      level: 0,
      order: -1015,
      ignoreSettings,
      hasBadge: true,
      badgeValue: scheduleCount,
      badgeTooltip: toLocale("finStackMobileExt::rightMenuSchedulesBadgeTip").replace("{0}", scheduleCount.toStr),
      action: "window.app.ObtainMenu('" + context()->username + "', '{{targetRef}}', 'allSchedules', " + scheduleMenuSettings(null, true).toAxonCode + ")",
      keepOpen: true
    })//.add(mainDivider)

    scheduleRefs.each sRef => do
      curSched: schedules.find(v => v->id == sRef->id)
      if(curSched != null)
        menuItems = menuItems.add(curSched)
    end
  end

  menuItems
end


def ​

func:scheduleMenuSettings ​

scheduleMenuSettings(targetRef: null, showAll: false, fromForm: false) ​

Axon function


meta ​

deffunc:scheduleMenuSettings
isfunc
liblib:finStackMobile
namescheduleMenuSettings
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(targetRef:null, showAll: false, fromForm: false) => do
  scheduleLink: "#schedules?sid={id}"

  settings: {
    funcCall:if(fromForm) "scheduleMenu(" + targetRef.toAxonCode + ", " + showAll + ")" else if(showAll) "scheduleMenu(null, true)" else "scheduleMenu({{targetRef}})",
    header: toLocale("finStackExt::rightMenuSchedulesTitle"), //if(targetRef == null) else readById(targetRef).dis + "'s Schedules",
    folderPath:"",
    displayFunc:  if(fromForm) "scheduleDisplay(" + targetRef.toAxonCode + ")" else "scheduleDisplay({{targetRef}})",
    icon: "icon-calendar",
    iconTooltipFunc: if(fromForm) "scheduleIconTip(" + targetRef.toAxonCode + ")" else "scheduleIconTip({{targetRef}})",
    hasBadge: true,
    badgeValueFunc: "scheduleBadgeVal()",
    badgeTypeFunc: "scheduleBadgeType()",
    folderPathCount: 4,
    badgeTooltipFunc: "scheduleBadgeTip()",
    folderBadge: "schedules",
    hideBackButton: true,
    keepOpen: true
  }
end


def ​

func:scheduleMoveSchedulable ​

scheduleMoveSchedulable(oldId, newId) ​

Axon function


meta ​

deffunc:scheduleMoveSchedulable
isfunc
liblib:finStackMobile
namescheduleMoveSchedulable
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(oldId, newId) => do
  if (not oldId.isList) oldId = [oldId]

  oldId.each scheduleRef => do
    eval("secureReadAll(scheduleRef == " + scheduleRef.toAxonCode + ")").each x =>
      if(newId != "none") x.diff({scheduleRef: newId}).commit
      else x.diff({-scheduleRef}).commit

    readById(scheduleRef).diff({trash}).commit
  end
end


def ​

func:scheduleToolTreeForm ​

scheduleToolTreeForm(scheduleID) ​

Axon function


meta ​

deffunc:scheduleToolTreeForm
isfunc
liblib:finStackMobile
namescheduleToolTreeForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(scheduleID) => do
  sched: readById(scheduleID)
  schedulePath: "readById(" + scheduleID.toAxonCode + ").finElementOn(`form`.toStr())"

  body: [
    {
      name: "scheduleTree",
      editorType: "ractive",
      ractiveType: "tree",
      prompt: toLocale("finStackMobileExt::scheduleMenuToolsTip").replace("{0}", sched.dis),
      labelField: "dis",
      selectedValueTags: "name",
      height: 200,
      path: schedulePath,
      icon: "icon-gear"
    },  ///path:"readAll(program)"  read(schedule).finElementOn(\"form\")"

    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::scheduleMenuToolsTip"),
    "name": "scheduleTools",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "scheduleToolTreeFormCommit(\$scheduleTree, " + scheduleID.toAxonCode + ")",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:scheduleToolTreeFormCommit ​

scheduleToolTreeFormCommit(name, id) ​

Axon function


meta ​

deffunc:scheduleToolTreeFormCommit
isfunc
liblib:finStackMobile
namescheduleToolTreeFormCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(name, id) => do
  eval(name[0] + "(" + id.toAxonCode + ")")
end


def ​

func:selectActionDiscover ​

selectActionDiscover(id: null, connType: "bacnetConn", useConnDiscover: false) ​

Axon function


meta ​

deffunc:selectActionDiscover
isfunc
liblib:finStackMobile
nameselectActionDiscover
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id:null, connType: "bacnetConn", useConnDiscover: false) => do
  makeGrid: if(id == null) "finDbMakeConnectorGrid("+connType.toAxonCode+", \"discoverResults\")" else "finDbMakeConnectorGrid(\"finDiscoveryStatusCheck("+id.toAxonCode+")\", \"discoverResults\")"
  refreshTop: readCount(parseFilter("finDiscovery and extName == "+connType.replace("Conn", "").toAxonCode)) == 0
  discoverType: connType.replace("Conn", "Discover")

  connGridPanel: {
    panelTitle: if(id == null) toLocale("finStackMobileExt::addedDevices") else toLocale("finStackMobileExt::discoveredDevices"),
    view: "default",
    viewId: "bacnetLearnedPanel",
    dis: toLocale("finStackMobileExt::discoverConnType").replace("{connType}", connType.replace("Conn", "").capitalize),
    default: true,
    resolveWith: {type: "axon", action: makeGrid}
  } //END discoverMainPanel

  discoverButtons:[
    {
      label: toLocale("finStackExt::add"),
      icon: "ic|icon-plus",
      action: {
        type: "axon",
        action: "dbDiscoveryAdd(({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef), false, \"window.app.RefreshBuilderTreeNodeForId('@folderPath:bacnetConn:'); window.app.RefreshBuilderGridAt(0, 'panel')\")"
      }, //; window.app.RefreshBuilderGridAt(0, 'discover')
      enableWhen: "args.selectedItems.length > 0"
    }
  ]

  //make panel
  if(id == null)
  do
    mainButtons: [{
      label: toLocale("finStackMobileExt::discover"),
      icon: "ic|icon-flashlight",
      action: {
        type: "js",
        action: "_builder.fire(\"discover\", {force: true}); " + (
          if (refreshTop) "window.app.RefreshBuilderTreeNodeForId('@folderPath:"+connType+":'); setTimeout(function() { window.app.RefreshBuilderTreeNodeForId('@folderPath:"+discoverType+":'); }, 750);"
          else "window.app.RefreshBuilderTreeNodeForId('@folderPath:"+discoverType+":');"
        )
      }
    }]

    // add the discover settings button if a form exists for it
    // DOC_THIS - this needs to be documented when docing the connector tree
    // form func name needs to look like: finFormFooConnDisocverSettings
    discoverForm: "finForm"+connType.capitalize+"DiscoverSettings"

    if (not funcs(name == discoverForm).isEmpty)
      mainButtons = mainButtons.insert(0, {
        label: toLocale("finStackMobileExt::discoverSettings"),
        icon: "ic|icon-gear",
        action: {type: "axon", action: discoverForm+"()"}
      })
    // end DOC_THIS

    connGridPanel = connGridPanel.merge({
      buttons: mainButtons,

      interactions:{
        drop: {type: "axon", action: "dbDragActionAddConnector(\"bacnetLearnedPanel\", {{args.dragSource[id]}})"}
        //drop: {type: "axon", action: "dbDragActionAddConnector(\"{{args.dragTarget.viewId}}\", {{args.dragSource.map(function(i) {return i.id;})}})"}
      },

      discover: {
        panelTitle: toLocale("finStackMobileExt::discoveredDevices"),
        viewId: "connectorDiscoveredPanel",
        buttons: discoverButtons,

        query: {
          view: "default",
          type: "axon",
          indeterminate: true,
          action: "dbBuilderDiscoverConnectors("+ (if (connType != "bacnetConn") "null, " + connType.toAxonCode + ", " + useConnDiscover else "")+")"
        } //END QUERY
      } //END DISCOVER
    })
  end else do
    connGridPanel = connGridPanel.merge({
      buttons: discoverButtons
    })
  end

  return {
    panels:[connGridPanel]
  }
end


def ​

func:selectActionEquipTree ​

selectActionEquipTree(selectedRef: null) ​

Creates panels to be displayed on when an item from the equip tree is selected.

These panels will include a data grid and all the Graphics whose graphicOn matches the selected item.

selectedRef - The id of the selected item.


meta ​

constructselectActionEquipTree(read(equip)->id)
deffunc:selectActionEquipTree
isfunc
liblib:finStackMobile
nameselectActionEquipTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(selectedRef: null) => do
  // finds the next valid level from the navMeta
  findNextValidLevel: (navList, parentRef, curNav, curIndex) => do
    nextLevel: navList[curIndex + 1]
     if(nextLevel.startsWith("[") and readCount(parseFilter(curNav+"Ref =="+parentRef.toAxonCode+" and "+nextLevel[1..-2])) == 0)
       findNextValidLevel(navList, parentRef, curNav, curIndex + 1)
     else return nextLevel
  end

  // vars
  curRec: if(selectedRef == null) null else readById(selectedRef, false)
  navMetaList: read(navMeta)->equipPath[1..-1].split("/")
  curNavMeta: if(curRec != null) finNavMetaWhoAmI(curRec) else "topLevel"
  curNavPos: eachWhile(navMetaList) (x, i) => if(x == curNavMeta or x == "["+curNavMeta+"]") i
  gridQuery: ""
  watchName: "DB Builder Data Grid View " + random(0..10000) //internal use, no need to localize

  // create an Axon query to populate the grid view
  if(curNavMeta == "point") gridQuery = "id == "+selectedRef.toAxonCode
  else if(selectedRef == null) gridQuery = "site"
  else
  do
    nextLevel: findNextValidLevel(navMetaList, selectedRef, curNavMeta, curNavPos)

    if(nextLevel.startsWith("["))
      nextLevel = nextLevel[1..-2]

    // equipRef == @123 and (equip or floor)
    gridQuery = curNavMeta+"Ref =="+selectedRef.toAxonCode+(if(curNavMeta == "equip") " and (equip or "+ nextLevel + ")" else " and "+nextLevel)
  end

  watchData: readAll(parseFilter(gridQuery))
  watchData.finGridFilter(point and (not curVal or curStatus == "stale")).watchOpen(watchName)

  buttonList:[
    {
      label   : toLocale("j2FinToolsExt::cloneTags"),
      icon    : "ic|icon-copy",
      action  : {
        type: "axon",
        action: "finFormRecordTagClone({{args.selectedItems[0].id}})"
      },
      enableWhen: "args.selectedItems.length == 1"
    },

    {
      label   : toLocale("j2FinToolsExt::saveTemplate"),
      icon    : "ic|icon-download",
      action  : {
        type: "axon",
        action: "finFormSaveTemplate({{args.selectedItems[0].id}})"
      },
      enableWhen: "args.selectedItems.length == 1"
    },

    {
      label  : toLocale("j2FinToolsExt::restoreTemplate"),
      icon   : "ic|icon-upload",
      action : {
        type: "axon",
        action: "finFormRestoreTemplate()"
      }
    },

    {
      label   : toLocale("j2FinToolsExt::duplicateXTimes"),
      icon    : "ic|icon-duplicate",
      action  : {
        type: "axon",
        action: "finFormBatchDuplicate({{args.selectedItems[0].id}})"
      },
      enableWhen: "args.selectedItems.length == 1"
    },

    {
      label: toLocale("j2FinToolsExt::searchAndReplace"),
      icon: "ic|icon-flashlight",
      action: {
        type: "axon",
        action: "finFormReplace({{args.selectedItems[0].id}}, ({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef))"
      },
      enableWhen: "args.selectedItems.length > 0"
    }
  ]

  if (curNavMeta == "floor")
  do
    buttonList = buttonList.insert(3, {
        label: toLocale("j2FinToolsExt::massEditTags"),
        icon: "ic|icon-tags",
        action: {
          type: "axon",
          action: "finMassEditTags(({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef))"
        },
        enableWhen: "args.selectedItems.length > 0"
    }).insert(5, {
      label: toLocale("finStackMobileExt::batchRecordEditor.title"),
      icon: "ic|icon-view-list",
      action: {
        type: "js",
        action: "window.app.InitBatchRecordEditor('{{args.selectedItems[0].id}}', 'update', undefined, function() { window.app.RefreshBuilderTreeNodeForId('{{args.selectedItems[0].id}}'); window.app.RefreshBuilderGridAt(0, 'panel'); }, finstack)"
      },
      enableWhen: "args.selectedItems.length == 1"
    })
  end
  else if (curNavMeta == "equip")
  do
    buttonList = buttonList.insert(0, {
      label: toLocale("j2FinToolsExt::cloneEquipPointTags"),
      icon: "ic|icon-tag",
      action: {
        type: "axon",
        action: "finCloneEquipPointTags(({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef).toRecList)"
      },
      enableWhen: "args.selectedItems.length > 0"
    }).insert(4, {
      label: toLocale("finStackExt::gbApplyBatchTags"),
      icon: "ic|icon-tags",
      action: {
        type: "axon",
        action: "finFormApplyBatchTags()"
      },
    }).insertAll(5, [
      {
        label: toLocale("finStackMobileExt::openRecordLib"),
        icon: "ic|icon-view-list",
        action: {
          type: "js",
          action: "window.app.InitBatchRecordEditor('"+selectedRef.toAxonCode+"', 'update', undefined, function() { window.app.RefreshBuilderTreeNodeForId('"+selectedRef.toAxonCode+"'); window.app.RefreshBuilderGridAt(0, 'panel'); }, finstack)"
        }
      },

      {
        label: toLocale("finStackMobileExt::saveRecordLib"),
        icon: "ic|icon-archive",
        action: {
          type: "axon",
          action: "finSavePointRecordsForm({{args.selectedItems[0].id}}, ({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef))"
        },
        enableWhen: "args.selectedItems.length > 0"
      }
    ])[0..6].remove(3).remove(2)
  end

  gridPanel: {
    view: "default",
    viewId: "equipMainPanel", //curRec.dis.toTagName+"MainPanel",
    dis: if (curRec != null) curRec.dis else toLocale("finStackMobileExt::topLevel"),
    default: false,
    resolveWith: {
      type: "axon",
      action: "dbMakeDataGridPanel("+gridQuery.toAxonCode+")"
    },

    buttons: buttonList
  }

  views: []

  if(selectedRef == null and read(topLevel, false) != null)
    views = [gridPanel].addAll(dbGraphicPanels(read(topLevel)->id, "equip"))
  else
    views = [gridPanel].addAll(dbGraphicPanels(selectedRef, "equip"))

  watchClose(watchName)

  return {
    panels:views
  }
end


def ​

func:selectActionGraphicsTree ​

selectActionGraphicsTree(folderPath: "") ​

Axon function


meta ​

deffunc:selectActionGraphicsTree
isfunc
liblib:finStackMobile
nameselectActionGraphicsTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(folderPath: "") => do
  title: toLocale("finStackExt::rightMenuGraphicsTitle")
  resolveActStr: "dbMakeDataGridPanel(\"fin5\", \"graphics\")"
  projName: context()->projName

  if(folderPath != "") do
    folderPath = cleanFolderPathName(folderPath)
    title = "Graphics in " + folderPath.split("/")[-1]
    resolveActStr = "dbMakeDataGridPanel(\"fin5 and folderPath\", \"graphics\").findAll(v => not v->folderPath.isEmpty() and cleanFolderPathName(v->folderPath).contains("+folderPath.toAxonCode+"))"
  end

  return {
    panels:[
      {
        view: "default",
        viewId: "graphicsMainPanel",
        dis: toLocale("finStackExt::rightMenuGraphicsTitle"),
        panelTitle: title,
        default: true,
        resolveWith: { type: "axon", action: resolveActStr},

        buttons: [
          {
            finNetworkIgnore,
            label: toLocale("finStackExt::coreEdit"),
            icon: "ic|icon-document-edit",
            action: {
              type: "axon",
              action: "if({{args.targetRef}} == null) finStackMenuOkForm("+toLocale("finStackExt::warning").toAxonCode+", "+toLocale("finStackMobileExt::openGraphicBuilderInNewWindow").toAxonCode+", {completeAction: \"window.open((finstack.pathPrefix || '')+'/finMobile/" + projName + "#frame?url=' + encodeURIComponent('/graphicsBuilder/" + projName + "/#graphicRef={{args.selectedItems[0].id}}'))\", includeCancel: true}) " +
                      "else finStackMenuOkForm("+toLocale("finStackExt::warning").toAxonCode+", "+toLocale("finStackMobileExt::openGraphicBuilderInNewWindow").toAxonCode+", {completeAction: \"window.open((finstack.pathPrefix || '')+'/finMobile/" + projName + "#frame?targetRef={{args.targetRef}}&url=' + encodeURIComponent('/graphicsBuilder/" + projName + "/#graphicRef={{args.selectedItems[0].id}}&targetRef={{args.targetRef}}'))\", includeCancel: true})"
            },
            enableWhen: "args.selectedItems.length == 1"
          },

          {
            label: toLocale("finStackExt::delete"),
            icon: "ic|icon-minus",
            action: {
              type: "axon",
              action: "finFormDBBuilderDelete(({{args.selectedItems[id]}}).map(r => {id: r.replace(\"@\", \"\").parseRef, dis: r.replace(\"@\", \"\").parseRef.readById.dis}), null, null, \"graphics\")"
            },
            enableWhen: "args.selectedItems.length > 0"
          },

          {
            label: toLocale("finStackMobileExt::makeDefault"),
            icon: "ic|icon-checkmark",
            action: {
              type: "js",
              action: "finstack.eval('readByIds(({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef)).toRecList.map(r => r.diff({default})).commit').then(function(event) { window.app.RefreshBuilderGridAt(0, 'panel'); });"
            },
            enableWhen: "args.selectedItems.length > 0 && args.selectedItems.every(item => {return item.default == null || item.default == undefined;})"
          },

          {
            label: toLocale("finStackMobileExt::removeDefault"),
            icon: "ic|icon-cross",
            action: {
              type: "js",
              action: "finstack.eval('readByIds(({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef)).toRecList.map(r => r.diff({-default})).commit').then(function(event) { window.app.RefreshBuilderGridAt(0, 'panel'); });"
            },
            enableWhen: "args.selectedItems.length > 0 && args.selectedItems.every(item => {return item.default;})"
          },

          {
            label: toLocale("j2FinToolsExt::batchTags"),
            icon: "ic|icon-tags",
            action: {
              type: "axon",
              action: "finGraphicsBatchTags(null, ({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef))"
            },
            enableWhen: "args.selectedItems.length > 0"
          },

          {
            label: toLocale("j2FinToolsExt::copyFromGraphic"),
            icon: "ic|icon-copy",
            action: {
              type: "axon",
              action: "finCopyFromGraphicForm({{args.selectedItems[0].id}}, null, null)"
            },
            enableWhen: "args.selectedItems.length == 1"
          },

          {
            label: toLocale("j2FinToolsExt::deleteRecords"),
            icon: "ic|icon-document-remove",
            action: {
              type: "axon",
              action: "finGraphicsDeleteRecs(null, ({{args.selectedItems[id]}}).map(r => r.replace(\"@\", \"\").parseRef))"
            },
            enableWhen: "args.selectedItems.length > 0"
          },

          {
            label: toLocale("finStackMobileExt::toolTipEditGraphicOn"),
            icon: "ic|icon-tag",
            action: {
              type: "axon",
              action: "finEditGraphicOn({{args.selectedItems[0].id}}, {{args.targetRef}}, false, true)"
            },
            enableWhen: "args.selectedItems.length == 1"
          }
        ]
      }
    ]
  }
end


def ​

func:selectActionJobTree ​

selectActionJobTree(folderPath: "", jobId: null) ​

Axon function


meta ​

deffunc:selectActionJobTree
isfunc
liblib:finStackMobile
nameselectActionJobTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(folderPath: "", jobId: null) => do
  x: dbBuilderSelectAction({dis: "Jobs", baseQuery: "job"}, jobId)

  title: toLocale("finStackMobileExt::rightMenuJobs")
  resolveActStr: ""

  addButtonAction: ""
  deleteButtonAction: ""
  editButtonAction: ""

  deleteButtonEnable: ""
  editButtonEnable: ""

  if(folderPath != "")
  do
    addButtonAction = "jobCreateForm(null, null, "+folderPath.toAxonCode+", true)"
    folderPath = cleanFolderPathName(folderPath)
  end
  else
    addButtonAction = "jobCreateForm(null, null, null, true)"

  //root or folder
  if(jobId == null)
  do
    if(folderPath != "")
    do
      folderPath = cleanFolderPathName(folderPath)
      title = toLocale("finStackMobileExt::itemInObj").replace("{itemName}", toLocale("finStackMobileExt::rightMenuJobs")).replace("{objectName}", folderPath.split("/")[-1])
      resolveActStr = "dbMakeDataGridPanel(\"readAll(job and folderPath)\", \"job\").findAll(v => not v->folderPath.isEmpty() and cleanFolderPathName(v->folderPath).contains("+folderPath.toAxonCode+"))"
    end

    else
    do
      deleteButtonAction = "jobTrashForm({{args.selectedItems[id]}}, false)"
      deleteButtonEnable = "args.selectedItems.length > 0"
    end

    editButtonAction = "jobCreateForm({{args.selectedItems[0].id}}, null, null, true)"
    editButtonEnable = "args.selectedItems.length == 1"
  end
  //job selected
  else
  do
    deleteButtonAction = "jobTrashForm(["+jobId.toAxonCode+"], false)"
    editButtonAction = "jobCreateForm("+jobId.toAxonCode+", null, null, true)"
  end

  buttonList: [
    {
      label: toLocale("finStackExt::add"),
      icon: "ic|icon-plus",
      action: {type: "axon", action: addButtonAction}
    },

    {
      label: toLocale("finStackExt::delete"),
      icon: "ic|icon-trash",
      enableWhen: deleteButtonEnable,
      action: {type: "axon", action: deleteButtonAction}
    },

    {
      label: toLocale("finStackMobileExt::jobLogsFormHeader"),
      icon: "ic|icon-view-list",
      action: {type: "js", action: "_builder.fire(\"discover\", {force:true})"}
    },

    {
      label: toLocale("finStackExt::folioQueryRun"),
      icon: "ic|icon-media-play",
      enableWhen: "args.selectedItems.length > 0",
      action: {type: "axon", action: "{{args.selectedItems[id]}}.each(x=> eval(\"jobRun(\"+x+\")\"))"}
    },

    {
      label: toLocale("finStackExt::coreEdit"),
      icon: "ic|icon-pencil",
      enableWhen: editButtonEnable,
      action: {type: "axon", action: editButtonAction}
    },

    {
      label: toLocale("finStackMobileExt::enable"),
      icon: "ic|icon-checkmark",
      enableWhen: "args.selectedItems.some(item => {return item.disabled;})",
      action: {
        type: "axon",
        action: "finFormConfirmChangesAlert("+
            "\"([\"+({{args.selectedItems[id]}}).concat(\",\")+\"]).map(r => r.readById.diff({-disabled})).commit\", " +
            "\"Enable selected jobs?\", " +
            "\"window.app.RefreshBuilderGridAt(0, 'panel')\")"

        //"{{args.selectedItems.map(function(itm){ return itm.id })}}.map(x=> x[1..-1].parseRef).toRecList.each(x=> x.diff({-disabled}).commit)"
      }
    },

    {
      label: toLocale("finStackMobileExt::jobMenuDisable"),
      icon: "ic|icon-cross",
      enableWhen: "args.selectedItems.some(item => {return item.disabled == null || item.disabled == undefined;})",
      action: {
        type: "axon",
        action: "finFormConfirmChangesAlert("+
            "\"([\"+({{args.selectedItems[id]}}).concat(\",\")+\"]).map(r => r.readById.diff({disabled})).commit\", " +
            "\"Disable selected jobs?\", " +
            "\"window.app.RefreshBuilderGridAt(0, 'panel')\")"

        //"{{args.selectedItems.map(function(itm){ return itm.id })}}.map(x=> x[1..-1].parseRef).toRecList.each(x=> x.diff({disabled}).commit)"
      }
    }
  ]

  //root or folder
  if(jobId == null)
  do
    x = x->panels[0].merge({
      panelTitle: title,
      buttons: buttonList,
      discover: {query: {type: "axon", action: "dbMakeDataGridPanel(\"jobStatusAll()\")"}}
    })

    if(not resolveActStr.isEmpty)
      x = x.merge({
        resolveWith: x->resolveWith.merge({action: resolveActStr})
      })
  end
  //job is selected
  else
  do
    x = x->panels[0].merge({
      buttons: [buttonList[0], buttonList[1], buttonList[4]]
    })
  end

  {panels: [x]}
end


def ​

func:selectActionProgramCatTree ​

selectActionProgramCatTree(cat) ​

Axon function


meta ​

deffunc:selectActionProgramCatTree
isfunc
liblib:finStackMobile
nameselectActionProgramCatTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(cat) => do
  {panels: [
    {
      view: "default",
      default: true,
      viewId: "programsMainPanel",
      panelTitle: toLocale("finStackMobileExt::categoryBlocks").replace("{categoryName}", cat),
      resolveWith: {
        type: "axon",
        action: "dbMakeDataGridPanel(\"finBlocks().findAll(x=> x[\\\"category\\\"] == "+ toAxonCode(cat).replace("\"","\\\"") +")\")"
      }
    }
  ]}
end


def ​

func:selectActionProgramCatTree2 ​

selectActionProgramCatTree2(name) ​

Axon function


meta ​

deffunc:selectActionProgramCatTree2
isfunc
liblib:finStackMobile
nameselectActionProgramCatTree2
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(name) => do
  {panels: [
    {
      view: "default",
      default: true,
      viewId: "programsMainPanel",
      panelTitle: toLocale("finStackMobileExt::propsOfProgram").replace("{programName}", name),
      resolveWith: {
        type: "axon",
        //action: "dbMakeDataGridPanel(\"finBlocks().findAll(x=> x[\\\"category\\\"] == "+ toAxonCode(cat).replace("\"","\\\"") +")\")"
        action: "dbMakeDataGridPanel(\"finBlocks().find(x=> x->name==\\\""+name+"\\\")->props.ioReadZinc\")"
      }
    }
  ]}
end


def ​

func:selectActionProgramTasksTree ​

selectActionProgramTasksTree(id, target) ​

Axon function


meta ​

deffunc:selectActionProgramTasksTree
isfunc
liblib:finStackMobile
nameselectActionProgramTasksTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, target) => do
  {
    panels: [
      {
        view: "default",
        default: true,
        viewId: "programsMainPanel",
        panelTitle: toLocale("finStackMobileExt::varsOnProgTaskTitle").replace("{taskDis}", target.readById.dis).replace("{programName}", id.readById.dis),

        resolveWith: {
          type: "axon",
          action: "dbMakeDataGridPanel(\"controlTasks(@"+id+", @"+target+").map(x=> x.merge({bref: if(x.has(\\\"bindingRef\\\")) x->bindingRef.toAxonCode else \\\"\\\", hasAction: x.has(\\\"bindingRef\\\") and x->bindingRef.readById.has(\\\"actions\\\"), hasCmd: not x.has(\\\"bindingRef\\\")}))\")"
        },

        buttons: [
          {
            label: toLocale("finStackMobileExt::viewRoutines"),
            icon: "ic|icon-search",
            action: {
              type: "js",
              action: "_builder.fire(\"discover\",{force:true})"
            }
          },

          {
            label: toLocale("finStackMobileExt::unbind"),
            icon: "ic|icon-link-broken",
            enableWhen: "args.selectedItems.length == 1 && args.selectedItems[0].unlinkMode == undefined",
            action: {
              type: "axon",
              action: "blineConfirmBindUnbindForm(@"+id+",@"+target+",\"{{args.selectedItems[0].name}}\",true)"
            }
          },

          {
            label: toLocale("finStackMobileExt::bLineBind"),
            icon: "ic|icon-link",
            enableWhen: "args.selectedItems.length == 1 && args.selectedItems[0].unlinkMode != undefined",
            action: {
              type: "axon",
              action: "blineConfirmBindUnbindForm(@"+id+",@"+target+",\"{{args.selectedItems[0].name}}\",false)"
            }
          },

          {
            label: toLocale("finStackExt::action"),
            icon: "ic|icon-gear",
            enableWhen: "args.selectedItems.length == 1 && args.selectedItems[0].hasAction == true",
            action: {
              type: "js", //"axon",
              action: "window.app.ShowActionsFor('{{args.selectedItems[0].bref}}')"
            }
          },

          {
            label: toLocale("finStackMobileExt::commandAbbr"),
            icon: "ic|icon-gear",
            enableWhen: "args.selectedItems.length == 1 && args.selectedItems[0].hasCmd == true",
            action: {
              type: "axon",
              action: "blineProjVarCommandForm(\"{{args.selectedItems[0].name}}\",\"{{args.selectedItems[0].kind}}\",@"+id+",@"+target+")"
            }
          }
        ],

        discover: {
          query: {
            type: "axon",
            action: "dbMakeDataGridPanel(\"controlTasks(@"+id+", @"+target+").meta->routines.ioReadZinc\")"
          },

          buttons: [
            {
              label: toLocale("finStackExt::folioQueryRun"),
              icon: "ic|icon-media-play",
              enableWhen: "args.selectedItems.length == 1",
              action: {
                type: "axon",
                action: "runRoutine(@"+id+", @"+target+", \"{{args.selectedItems[0].name}}\")"
              }
            },

            {
              label: toLocale("finStackMobileExt::rightMenuDebug"),
              icon: "ic|icon-search",
              enableWhen: "args.selectedItems.length == 1",
              action: {
                type: "axon",
                action: "finFormTextareaOk(toLocale(\"finStackMobileExt::rightMenuDebug\"), debugRoutineCode(@"+id+", @"+target+", \"{{args.selectedItems[0].name}}\"))"
              }
            }
          ]
        }
      }
    ]
  }
end


def ​

func:selectActionProgramTree ​

selectActionProgramTree(folderPath: "") ​

Axon function


meta ​

deffunc:selectActionProgramTree
isfunc
liblib:finStackMobile
nameselectActionProgramTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(folderPath: "") => do
  x: dbBuilderSelectAction({dis: toLocale("finStackExt::programs"), baseQuery: "programOn", itemProperty:"programOn"})->panels[0]
  title: toLocale("finStackExt::programs")
  resolveActStr: "dbMakeDataGridPanel(\"readAll(programOn)\", \"programs\").removeCols([\"program\",\"programSource\", \"programVars\"])"
  projName: context()->projName

  if(folderPath != "") do
    folderPath = cleanFolderPathName(folderPath)
    title = toLocale("finStackMobileExt::programsInFolder").replace("{folder}", folderPath.split("/")[-1])
    resolveActStr = "dbMakeDataGridPanel(\"readAll(programOn and folderPath)\", \"programs\").removeCols([\"program\",\"programSource\", \"programVars\"]).findAll(v => not v->folderPath.isEmpty() and cleanFolderPathName(v->folderPath).contains("+folderPath.toAxonCode+"))"
  end

  editJsAction:{
    includeCancel: true,
    completeAction: "var win;\n"+
      "if('{{args.targetRef}}' == null) win = window.open((finstack.pathPrefix || '')+'/finMobile/"+projName+"#frame?url='+encodeURIComponent('/pod/finBlockProgrammingExt/index.html#targetRef={{args.selectedItems[0].id}}&proj="+projName+"title=showSettings')); \n" +
      "else win = window.open((finstack.pathPrefix || '')+'/finMobile/"+projName+"#frame?targetRef={{args.targetRef}}&url='+encodeURIComponent('/pod/finBlockProgrammingExt/index.html#targetRef={{args.selectedItems[0].id}}&proj="+projName+"&title=showSettings&equipRef={{args.targetRef}}')); \n" +
      "setTimeout(function(){\n"+
      "  win.app.ObtainMenu(\n"+
      "    '"+finGetCurrentUser()->username+"',\n"+
      "    '{{args.targetRef}}',\n"+
      "    'taskData',\n"+
      "    {\n"+
      "      iconFunc:\"blineVariableIcon({{args.targetRef}})\",\n"+
      "      badgeTooltipFunc:\"blineTaskVarBadgeTooltip({{args.targetRef}})\",\n"+
      "      iconClassFunc:\"blineTaskVarIconColor()\",\n"+
      "      badgeValueFunc:\"blineTaskVarBadgeVal()\",\n"+
      "      display:\"name\",\n"+
      "      hasBadge:true,\n"+
      "      iconTooltipFunc:\"blineTaskVarTip({{args.targetRef}})\",\n"+
      "      hideBackButton:true,\n"+
      "      keepOpen:true,\n"+
      "      iconType:\"class\",\n"+
      "      funcCall:\"blineTaskMenu({{args.targetRef}}, '{{args.selectedItems[0].name}}', true)\",\n"+
      "      badgeTypeFunc:\"blineTaskVarBadgeColor({{args.targetRef}})\"\n"+
      "    }\n"+
      "  )\n"+
      "}, 2000)"
    }

  x = x.merge({
    panelTitle: title,
    buttons: [
      {
        finNetworkIgnore,
        label: toLocale("finStackExt::add"),
        icon: "ic|icon-plus",
        action: {
          type: "axon",
          action: "blineCreateNewProgForm({{args.targetRef}}, null, \"\")"
        }
      },

      {
        finNetworkIgnore,
        label: toLocale("finStackExt::coreEdit"),
        icon: "ic|icon-pencil",
        enableWhen: "args.selectedItems.length == 1",
        action: {
          type: "axon",
          action: "finStackMenuOkForm("+toLocale("finStackExt::warning").toAxonCode+", toLocale(\"finStackMobileExt::openBlineInNewWindow\"), "+editJsAction.toAxonCode+")"
        }
      },

      {
        label: toLocale("finStackMobileExt::hostDisplayName"),
        icon: "ic|icon-pencil",
        enableWhen: "args.selectedItems.length == 1" ,
        action: {
          type: "axon",
          action: "blineEditProgramProperties({{args.selectedItems[0].id}}, [\"name\"], null, null, \"\")"
        }
      },

      {
        label: toLocale("finStackExt::hostDescription"),
        icon: "ic|icon-pencil",
        enableWhen: "args.selectedItems.length == 1",
        action: {
          type: "axon",
          action: "blineEditProgramProperties({{args.selectedItems[0].id}}, [\"description\"], null, null, \"\")"
        }
      },

      {
        label: toLocale("finStackMobileExt::programOn"),
        icon: "ic|icon-pencil",
        enableWhen: "args.selectedItems.length == 1",
        action: {
          type: "axon",
          action: "blineEditProgramOn({{args.selectedItems[0].id}}, {{args.targetRef}}, false, true)"
        }
      },

      {
        label: toLocale("finStackExt::delete"),
        icon: "ic|icon-trash",
        enableWhen: "args.selectedItems.length > 0",
        action: {
          type: "axon",
          action: "finFormDBBuilderDelete(({{args.selectedItems[id]}}).map(r => {id: r.replace(\"@\", \"\").parseRef, dis: readById(r.replace(\"@\", \"\").parseRef).dis}), null, null, \"programs\", \"\")"
        }
      },
    ],
    resolveWith: x->resolveWith.merge({
      action: resolveActStr
    })
  })

  {panels: [x]}
end


def ​

func:selectActionProgramVarBindingsTree ​

selectActionProgramVarBindingsTree(id) ​

Axon function


meta ​

deffunc:selectActionProgramVarBindingsTree
isfunc
liblib:finStackMobile
nameselectActionProgramVarBindingsTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  {panels: [
    {
      view: "default",
      default: true,
      viewId: "programsMainPanel",
      panelTitle: toLocale("finStackMobileExt::varBindingForProg").replace("{programName}", id.readById.dis),
      resolveWith: {
        type: "axon",
        action: "dbMakeDataGridPanel(\"readById(@"+id+")->programVars.ioReadZinc\").map(pv => pv.set(\"dis\", if (pv.has(\"display\")) pv->display else pv->name))"
      },
      buttons: [
        {
          label: toLocale("finStackExt::coreEdit"),
          icon: "ic|icon-pencil",
          enableWhen: "args.selectedItems.length == 1",
          action: {
            type: "axon",
            action: "blineEditProgramVars(@"+id+", 1, \"{{args.selectedItems[0].name}}\")"
          }
        }
      ]
    }
  ]}
end


def ​

func:selectActionScheduleTree ​

selectActionScheduleTree(folderPath: null) ​

Axon function


meta ​

deffunc:selectActionScheduleTree
isfunc
liblib:finStackMobile
nameselectActionScheduleTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(folderPath: null) => do
  if (folderPath.isRef)
    folderPath = finIdToFolderPath(folderPath)

  x: dbBuilderSelectAction({dis: toLocale("finStackMobileExt::jobFormSchedule"), baseQuery: "schedule", findRefs: "scheduleRef"}, folderPath)
  title: toLocale("finStackExt::rightMenuSchedulesTitle")

  addButtonAction: ""

  if(folderPath != null)
  do
    title = toLocale("finStackMobileExt::itemInObj").replace("{itemName}", title).replace("{objectName}", folderPath.split("/")[-1])
    addButtonAction = "scheduleCreateNewForm(null, false, null, "+folderPath.toAxonCode+")"
  end else do
    addButtonAction = "scheduleCreateNewForm(null, false, null, \"\")"
    folderPath = ""
  end

  x = x->panels[0].merge({
    panelTitle: title,
    buttons: [
      {
        label: toLocale("finStackExt::add"),
        icon: "ic|icon-plus",
        action: {type: "axon", action: addButtonAction}
      },

      {
        label: toLocale("finStackExt::delete"),
        icon: "ic|icon-minus",
        enableWhen: "args.selectedItems.length == 1",
        action: {
          type: "axon",
          action: "scheduleConfirmDeleteForm({{args.selectedItems[0].id}}, null, false, "+folderPath.toAxonCode+")"
        }
      },

      {
        label: toLocale("finStackExt::coreEdit"),
        icon: "ic|icon-document-edit",
        enableWhen: "args.selectedItems.length == 1",
        action: {
          type: "axon",
          action: "finFormEditSchedule({{args.selectedItems[0].id}}, "+folderPath.toAxonCode+")"
        }
      },

      {
        label: toLocale("fin5CoreExt::search"),
        icon: "ic|icon-search",
        action: {type: "js",  action: "_builder.fire(\"discover\")"}
      }
    ],

    interactions: {
      drop: {
        type: "js",
        action: "finstack.eval('dropActionScheduleTree('+JSON.stringify(({{args.dragSource}}).map(function (e) { delete e.interactions; delete e.actions; delete e.refreshSelf; delete e.refreshParent; return e; }))+', {{args.dragTarget.id}})')"
      },
    },

    discover: {
      query: {
        type: "axon",
        action: "dbMakeDataGridPanel(\"readAll(schedulable).findAll(x=> not x.has(`scheduleRef`.toStr) or x->scheduleRef.readById(false) == null)\")"
      },
      buttons: [
        {
          label: toLocale("finStackMobileExt::makeUnschedulable"),
          icon: "ic|icon-link-broken",
          enableWhen: "args.selectedItems.length > 0",
          action: {
            type: "axon",
            action: "each({{args.selectedItems[id]}}, x=> x[1..-1].parseRef.readById.diff({-schedulable, -scheduleRef}).commit)"
          }
        }
      ]
    }
  })

  {panels: [x]}
end


def ​

func:selectActionScheduleTree2 ​

selectActionScheduleTree2(schId) ​

Axon function


meta ​

deffunc:selectActionScheduleTree2
isfunc
liblib:finStackMobile
nameselectActionScheduleTree2
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(schId) => do
  scheduleRec: readById(schId, false)
  folderPath: scheduleRec["folderPath"]

  x: dbBuilderSelectAction({dis: toLocale("finStackMobileExt::jobFormSchedule"), baseQuery: "schedule", findRefs: "point and scheduleRef"}, schId)->panels[0]
  title: toLocale("finStackMobileExt::pointsAssignedTo").replace("{itemName}", scheduleRec.dis)

  if(folderPath == null)
    folderPath = ""

  x = x.merge({
    panelTitle: title,
    buttons: [
      {
        label: toLocale("finStackMobileExt::pointPriority"),
        icon: "ic|icon-scale",
        enableWhen: "args.selectedItems.length > 0",
        action: {type: "axon", action: "finFormSchedulePointPriority({{args.selectedItems[id]}})"}
      },

      {
        label: toLocale("finStackMobileExt::unlinkFromSchedule"),
        icon: "ic|icon-link-broken",
        enableWhen: "args.selectedItems.length > 0",
        action: {type: "js", action: "finstack.eval('each({{args.selectedItems[id]}}, x=> x[1..-1].parseRef.readById.diff({-scheduleRef}).commit)'); window.app.RefreshBuilderGridAt(0, 'panel');"}
      }
    ],
  })

  {panels: [x]}
end


def ​

func:selectActionTagBundlesTree ​

selectActionTagBundlesTree(selectedRef: "") ​

Axon function


meta ​

deffunc:selectActionTagBundlesTree
isfunc
liblib:finStackMobile
nameselectActionTagBundlesTree
overridable✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(selectedRef: "") => do
  selectFunc: ""
  title: toLocale("finStackMobileExt::tagBundles")
  addButtonAction: ""
  deleteButtonAction: ""
  editButtonAction: ""
  deleteButtonEnable: ""
  editButtonEnable: ""
  hasAntPod: readAll(ext).any(v => return v->ext == "finDbBuilderFormsExt")

  //folders
  if(selectedRef.isStr)
  do
    if(selectedRef != "")
    do
      if(selectedRef.startsWith("@"))
      do
        folderRec: readById(selectedRef[1..-1].parseRef, false)

        if(folderRec != null)
          title = toLocale("finStackMobileExt::itemInObj").replace("{itemName}", title).replace("{objectName}", folderRec.dis)
      end else
        title = toLocale("finStackMobileExt::itemInObj").replace("{itemName}", title).replace("{objectName}", selectedRef.split("/")[-1])

      addButtonAction = if (hasAntPod) "top.app.ShowRemotePopup(null, '/pod/finDbBuilderFormsExt/index.html#/tagBundles/form', {size: {w:'100%', h:'100%'}, position: {x:'center', y:'middle'}});" else "finFormDBAddEdit(\"tagBundle\", null, null, "+selectedRef.toAxonCode+")"
    end else
      addButtonAction = if (hasAntPod) "top.app.ShowRemotePopup(null, '/pod/finDbBuilderFormsExt/index.html#/tagBundles/form', {size: {w:'100%', h:'100%'}, position: {x:'center', y:'middle'}});" else "finFormDBAddEdit(\"tagBundle\", null, null, null, true)"

    deleteButtonAction = "finFormDBBuilderDelete(({{args.selectedItems}}).map((r, i) => {id: if(r[\"fakeId\"] != null) r->fakeId.replace(\"@\", \"\").parseRef else if (r->id.isDict) r->id->val.replace(\"@\", \"\").parseRef else r->id.replace(\"@\", \"\").parseRef, dis: r->dis}), null, null, \"tagBundle\", \"{{args.selectedItems[0].folderPath}}\")"
    deleteButtonEnable = "args.selectedItems.length > 0 && args.selectedItems.every(function (item) { return item.fakeId === undefined;} )"

    editButtonAction = if (hasAntPod) "var id; if(\"{{args.selectedItems[0].fakeId}}\" != \"undefined\") id = \"{{args.selectedItems[0].fakeId}}\"; else id = \"{{args.selectedItems[0].id}}\"; top.app.ShowRemotePopup(null, '/pod/finDbBuilderFormsExt/index.html#/tagBundles/form/'+id, {size: {w:'100%', h:'100%'}, position: {x:'center', y:'middle'}}); " + setRemotePopupBackground() else "finFormDBAddEdit(\"tagBundle\", {id: if(\"{{args.selectedItems[0].fakeId}}\" != \"undefined\")  {{args.selectedItems[0].fakeId}} else {{args.selectedItems[0].id}}, dis: \"{{args.selectedItems[0].dis}}\"}, null, \"{{args.selectedItems[0].folderPath}}\")"
    editButtonEnable = "args.selectedItems.length == 1 && args.selectedItems[0].fakeId == undefined"

    selectFunc = "dbMakeDataGridPanel(\"finFilteredFuncEval(tagBundleFunc, addTags or removeTags).addRows(readAll(tagBundle and not func)).removeCols([`order`.toStr,`name`.toStr])\", \"tagBundle\", "+selectedRef.toAxonCode+")"
  end
  //tagBundles
  else
  do
    foundItem: finFilteredFuncEval(tagBundleFunc, addTags or removeTags).addRows(readAll(tagBundle and not func)).find(v => v->id == selectedRef)

    if(foundItem != null)
    do
      //show results
      if(foundItem.has("allowFilter") and not foundItem->allowFilter.isEmpty)
      do
        title = title + " - " + toLocale("finStackMobileExt::resultsForSavedFilter").replace("{savedFilter}", foundItem.dis)
        selectFunc = "dbMakeDataGridPanel(\"finFilteredFuncEval(tagBundleFunc, addTags or removeTags).addRows(readAll(tagBundle and not func)).find(v => v->id == "+selectedRef.toAxonCode+")->allowFilter.parseFilter.readAll\", \"tagBundle\")"
      end
      //show tag bundle, because results would be everything in the db
      else
      do
        title = title + " - " + foundItem.dis
        selectFunc = "dbMakeDataGridPanel(\"finFilteredFuncEval(tagBundleFunc, addTags or removeTags).addRows(readAll(tagBundle and not func)).findAll(v => v->id == "+selectedRef.toAxonCode+")\", \"tagBundle\")"
      end

      addButtonAction = if (hasAntPod) "top.app.ShowRemotePopup(null, '/pod/finDbBuilderFormsExt/index.html#/tagBundles/form/null/"+ (if (foundItem["folderPath"] != null) foundItem["folderPath"].replace("/", "--") else "") +"', {size: {w:'100%', h:'100%'}, position: {x:'center', y:'middle'}}); " + setRemotePopupBackground() else "finFormDBAddEdit(\"tagBundle\", null, null, "+foundItem["folderPath"].toAxonCode+")"
      deleteButtonAction = "finFormDBBuilderDelete({id:"+selectedRef.toAxonCode+", dis: "+foundItem.dis.toAxonCode+"}, null, null, \"tagBundle\", "+(if(foundItem["folderPath"] != null) foundItem["folderPath"] else "").toAxonCode+")"
      editButtonAction = if (hasAntPod) "top.app.ShowRemotePopup(null, '/pod/finDbBuilderFormsExt/index.html#/tagBundles/form/"+selectedRef.toAxonCode+"', {size: {w:'100%', h:'100%'}, position: {x:'center', y:'middle'}}); " + setRemotePopupBackground() else "finFormDBAddEdit(\"tagBundle\", {id: "+selectedRef.toAxonCode+", dis: "+foundItem.dis.toAxonCode+"}, null, "+foundItem["folderPath"].toAxonCode+")"
    end
    else
      selectFunc = "dbMakeDataGridPanel(\"\", \"tagBundle\")"
  end

  buttonList: [
    {
      label: toLocale("finStackExt::add"),
      icon: "ic|icon-plus",
      action : {type: if (hasAntPod) "js" else "axon", action: addButtonAction}
    },

    {
      label: toLocale("finStackExt::delete"),
      icon: "ic|icon-minus",
      enableWhen: deleteButtonEnable,
      action : {type: "axon", action: deleteButtonAction},
    },

    {
      label: toLocale("finStackExt::coreEdit"),
      icon: "ic|icon-document-edit",
      enableWhen: editButtonEnable,
      action : {type: if (hasAntPod) "js" else "axon", action: editButtonAction}
    }
  ]

  return {
    panels:[
      {
        view: "default",
        viewId: "tagBundleMainPanel",
        panelTitle: title,
        dis: toLocale("finStackMobileExt::tagBundles"),
        default: true,
        resolveWith: { type: "axon", action: selectFunc},
        buttons: buttonList
      }
    ]
  }
end


def ​

func:userDeleteConfirm ​

userDeleteConfirm(id) ​

Axon function


meta ​

deffunc:userDeleteConfirm
isfunc
liblib:finStackMobile
nameuserDeleteConfirm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  body: [
  {name: "confirmLabel", editorType: "label", text: toLocale("finStackMobileExt::deleteUserPrompt") + userReadById(id).dis + " - " + userReadById(id)->username},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::delete"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::deleteUserQ"),
  "name": "userDeleteConfirmMobile",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "userDelete([" + id.toAxonCode + "])",
  "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:userFormSetPassword ​

userFormSetPassword(properties, optionals) ​

Axon function


meta ​

deffunc:userFormSetPassword
isfunc
liblib:finStackMobile
nameuserFormSetPassword
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(properties, optionals) => do
  body: [
    {name: "pass", editorType: "textinput", prompt: toLocale("finStackExt::settingsMenuPassword")+":", password: true},
    {name: "confirmPass", editorType: "textinput", prompt: toLocale("finStackMobileExt::passForm.confirmPassword")+":", password: true},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
  ]

  return {
    "dis": "Create New User - Password",
    "name": "userPassWord" + random(1..10000),
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "usersInputValidator(" + properties.toAxonCode + ", " + optionals.toAxonCode + ".merge({password, pass: \$pass, confirmPass: \$confirmPass}))",
    "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")", //setTimeout(window.app.LoadApplication('"+finCreateEmbeddedLink("users")+"'), 500)",
    "afterCompleteAction": "window.top.app.RefreshCurrentAppData()",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})

end


def ​

func:usersAccessFilterWizard ​

usersAccessFilterWizard(propertyList, choices) ​

Axon function


meta ​

deffunc:usersAccessFilterWizard
isfunc
liblib:finStackMobile
nameusersAccessFilterWizard
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(propertyList, choices) => do
  body: [
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: "Next", controlBar: true}
  ]

  accessFiltersToAdd: choices.find(v => v->property == "accessFilters")->val
  choices = choices.findAll(v => v->property != "accessFilters").map(row => row.set("property", row->property.toAxonCode).set("val", row->val.toAxonCode))

  accessFiltersToAdd.each x => do
    if(x == "actionAccessFilter")
      body = body.addAll([{name: "actionAccessSep", editorType: "separator"},
                          {name: "actionAccessFilter", editorType: "numericstepper", defVal:6, minVal: 1, maxVal: 10, prompt: toLocale("finStackMobileExt::actionAccessFilter")+":"}])
    else
      body = body.addAll([{name: "actionAccessSep", editorType: "separator"},
                          {name: x, editorType: "filter", prompt: toLocale("finStackMobileExt::"+x)+":"} //x.replace("AccessFilter", " Access Filter").capitalize

      ])
    choices = choices + ", " + x.toAxonCode + ": \$" + x
  end

  { "dis": toLocale("finStackMobileExt::createNewUser"),
    "name": "usersAccessFilterWizard",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "userFormSetPassword(" + propertyList.toAxonCode + ", " + choices + ")",
    "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersEditUsernameForm ​

usersEditUsernameForm(id, edit: false, data: null) ​

Axon function


meta ​

deffunc:usersEditUsernameForm
isfunc
liblib:finStackMobile
nameusersEditUsernameForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, edit: false, data: null) => do
  if(not edit) do
  body: [
    {name: "confirmLabel", editorType: "label", text: toLocale("finStackMobileExt::editUsernamePrompt")},
    {name: "label2", editorType: "label", text: toLocale("finStackMobileExt::contUsernamePrompt")},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::continue"), controlBar: true}
    ]

    { "dis": toLocale("finStackExt::pointsStateWarning"),
      "name": "editUserNameWarning",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "usersEditUsernameForm(" + id.toAxonCode + ", true)",
      "completeAction": "",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end else do
    body: [
      {
        name: "username",
        editorType: "textinput",
        prompt: toLocale("finStackExt::settingsMenuUsername")+":",
        defVal: if(data == null or data.trim == "") userReadById(id)->username else data
      },

      {
        name: "password",
        editorType: "textinput",
        prompt: toLocale("finStackExt::settingsMenuPassword")+":",
        password: true
      },

      {
        name: "confirmPass",
        editorType: "textinput",
        prompt: toLocale("finStackMobileExt::confirmNew")+":",
        password: true
      },

      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    if(data != null) body = body.insert(0,{name: "label", editorType: "label", text: toLocale("finStackMobileExt::editUserRequiredItems")})

    properties: {username: "\$username"}
    optionals: [{property: "\"pass\"", val: "\$password"}, {property: "\"confirmPass\"", val: "\$confirmPass"}]

    { "dis": toLocale("finStackMobileExt::editUserPass"),
      "name": if(date == null) "editUsernameandPassword" else "editUsernameandPassword" + random(1..10000),
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "if(\$password.isEmpty or \$confirmPass.isEmpty or \$password != \$confirmPass) usersEditUsernameForm("+id.toAxonCode+",true,\$username) else usersInputValidator(" + properties + ", " + optionals + ", null, " + id.toAxonCode + ")",
      "completeAction": "if(!\$username){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::usernameRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); } "+
                        "else if(!\$password){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::passwordRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); } "+
                        "else if(!\$confirmPass){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::passwordConfRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); } "+
                        "else if(\$password != \$confirmPass){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::confPasswordMismatch")+"', icon: 'icon-alarm', iconStyle:'color: red'}); } "+
                        "else{ window.app.ObtainMenu(null, '{{targetRef}}', 'userDetail', {funcCall: 'userDetailMenu(" + id.toAxonCode + ")', hideBackButton: true}); }",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:usersFormAppPermissions ​

usersFormAppPermissions(id) ​

Axon function


meta ​

deffunc:usersFormAppPermissions
isfunc
liblib:finStackMobile
nameusersFormAppPermissions
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  user: userReadById(id)
  fullAppList: finStackMenuAppList(true)
  curUserAppList: []
  setApps: []

  if(user.has("appAccess")) curUserAppList = curUserAppList.addAll(user->appAccess.split(","))
  if(user.has("finAppAccess")) curUserAppList = curUserAppList.addAll(user->finAppAccess.replace("finGraphics", "graphics").replace("historian", "trends").split(","))

  if(not user.has("appAccess") and not user.has("finAppAccess"))
    curUserAppList = null

  appList: fullAppList.map(row => do
    if(curUserAppList == null or curUserAppList.contains(row->appId)) {app: row->appId, access: true, dis: row->appName}
    else {app: row->appId, access: false, dis: row->appName}
  end)

  appList = appList.findAll(v => v->app != "projects")

  body: [
    /*{
      name: "appList",
      editorType: "list",
      listType: "checkbox",
      prompt: "Choose which apps to give " + user.dis + " access to:",
      dataProvider: appList.toAxonCode,
      labelField: "app",
      height: 300,
      defValTagName: "access",
      selectedTagValues: "app"
    },*/
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  appList.each mobileApp => do
    body = body.add({
      name: if(mobileApp->app == "graphics") mobileApp->app + "1" else mobileApp->app,
      editorType: "checkbox",
      label: mobileApp->dis,
      defVal: mobileApp->access,
      flex: "1 1 auto",
      width: 140
    })

    if(mobileApp->app == "graphics")
      setApps = setApps.add({app: "\"" + mobileApp->app + "\"", access: "\$graphics1"})
    else setApps = setApps.add({app: "\"" + mobileApp->app + "\"", access: "\$" + mobileApp->app})
  end

  { "dis": toLocale("finStackMobileExt::setUserAppPermissions"),
  "name": "userAppPermissions",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "usersFormAppPermissionsCommit(" + setApps + ", " + id.toAxonCode +")",//"finFormAlertOk(\"Still Under Development\", \"User app permissions will be updated\")", //echo(\$appList)", //readById(id).toAxonCode + ".diff({}, {remove}).commit",
  "finForm": marker(),
  "horizontal": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormAppPermissionsCommit ​

usersFormAppPermissionsCommit(appList, userId) ​

Axon function


meta ​

deffunc:usersFormAppPermissionsCommit
isfunc
liblib:finStackMobile
nameusersFormAppPermissionsCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(appList, userId) => do
  staticKey: finStackMenuStaticAppKey()

  allOn: appList.eachWhile(x => if(x->access) null else true) //appList.eachWhile(x => x->access == false)
  allOff: appList.eachWhile(x => if(not x->access) null else true) //appList.eachWhile(x => x->access == true)
  user: userReadById(userId)
  fin:"navTree, objectEditor,historianPopup,"
  norm: "help,finstack,equip,conn,"

  if(allOn == null)
    {id: user->id, mod: user->mod, -finAppAccess, -appAccess, mobileAppSet}.userEdit //, -finMobileAppAccess
  else if(allOff == null)
    {id: user->id, mod: user->mod, -appAccess, finAppAccess:"", mobileAppSet}.userEdit //, finMobileAppAccess: ""
  else do
    appList.each app => do
      if(app->access) do
        key: staticKey.find(v => v->mobile == app->app)
        key2: null
        if(key == null and app->app.endsWith("App")) key2 = staticKey.find(v => v->mobile == app->app[0..-4])

        //mobile = mobile + app->app + ","
        if(key != null and key->fin != "") fin = fin + key->fin + ","
        else do
          fin = fin + app->app + ","
          if(app->app.endsWith("App")) fin = fin + app->app[0..-4] + ","
        end

        if(key != null and key->norm != "") norm = norm + key->norm + ","
        else if(key2 != null and key2->norm != "") norm = norm + key2->norm + ","
      end
    end

    if(fin.endsWith(",")) fin = fin[0..-2]
    if(norm.endsWith(",")) norm = norm[0..-2]

    {id: user->id, mod: user->mod, appAccess: norm, finAppAccess: fin, mobileAppSet}.userEdit //, finMobileAppAccess: mobile
  end
end


def ​

func:usersFormClone ​

usersFormClone(id, newInfo: null) ​

Axon function


meta ​

deffunc:usersFormClone
isfunc
liblib:finStackMobile
nameusersFormClone
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, newInfo: null) => do
  userToClone: userReadById(id)
  defFirst: userToClone->firstName
  defLast: userToClone->lastName
  defUser: ""
  body:[]

  if(newInfo != null) do
    defFirst = newInfo->firstName
    defLast = newInfo->lastName
    defUser = newInfo->username
    body = body.add({name: "msg", editorType: "label", text: toLocale("finStackMobileExt::userPasswordMismatchPrompt")})
  end

  body = body.addAll([
    {name: "firstName", editorType: "textinput", prompt: toLocale("finStackMobileExt::userFuncsFirstName")+":", defVal: defFirst},
    {name: "lastName", editorType: "textinput", prompt: toLocale("finStackMobileExt::userFuncsLastName")+":", defVal: defLast},
    {name: "userName", editorType: "textinput", prompt: toLocale("finStackMobileExt::newUsername")+":", defVal: defUser},
    {name: "pass", editorType: "textinput", prompt: toLocale("finStackMobileExt::newPassword")+":", password: true},
    {name: "confirmPass", editorType: "textinput", prompt: toLocale("finStackMobileExt::confirmNew")+":", password: true},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackMobileExt::clone"), controlBar: true}
  ])

  { "dis": toLocale("finStackMobileExt::cloneUser")+": " + userToClone.dis,
  "name": if(newInfo == null) "userClone" else "userClone" + random(1..10000),
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "usersFormCloneCommit(" + id.toAxonCode + ", \$userName, \$pass, \$confirmPass, \$firstName, \$lastName)",
  "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormCloneCommit ​

usersFormCloneCommit(id, newUsername, newPass, passConfirm, firstName, lastName) ​

Axon function


meta ​

deffunc:usersFormCloneCommit
isfunc
liblib:finStackMobile
nameusersFormCloneCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, newUsername, newPass, passConfirm, firstName, lastName) => do
  userClone: userReadById(id).remove("id").remove("userAuth").remove("dis")

  if(newPass == passConfirm) do
    userClone = userClone.set("username", newUsername).set("firstName", firstName).set("lastName", lastName).set("dis", firstName + " " + lastName)
    userClone = userClone.set("tz", tz())
    userClone = userClone.set("userAuth", finGenScram())
    newUser: userNew(userClone)[0]
    if(newPass.size > 0)
      userSetPassword(newUser->username, newPass)
  end else
    usersFormClone(id, {firstName: firstName, lastName: lastName, username: newUsername})
end


def ​

func:usersFormCreateNew ​

usersFormCreateNew(selectedOptions: null, userinfo: null) ​

Axon function


meta ​

deffunc:usersFormCreateNew
isfunc
liblib:finStackMobile
nameusersFormCreateNew
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(selectedOptions: null, userinfo: null) => do
  optionList: [
    {dis: toLocale("finStackMobileExt::timeZone"), name: "tz"},
    {dis: toLocale("finStackMobileExt::userEmail"), name: "email"},
    {dis: toLocale("finStackMobileExt::homePath"), name: "finHomePath"},
    {dis: toLocale("finStackMobileExt::accessFilters"), name: "accessFilters"},
    {dis: toLocale("finStackMobileExt::markerTags"), name: "markers"},
    {dis: toLocale("finStackMobileExt::propertyTags"), name: "props"},
  ]

  //def values
  name: ""
  first: ""
  last: ""
  theme: 0
  lang: 0 //finUserLanguages().map(r => r->locale).index("en")
  magicDef: false
  roleDef: 0

  //mark selected options
  if(selectedOptions != null) do
    optionList = optionList.map(r => do
      if(selectedOptions.find(v => v == r->name) != null)
        r.set("selected", marker())
      else r
    end)
  end

  //reset fields
  if(userinfo != null) do
    name = userinfo.find(v => v->property == "username")->val
    first = userinfo.find(v => v->property == "firstname")->val
    last = userinfo.find(v => v->property == "lastname")->val

    theme = eachWhile([{dis: toLocale("finStackMobileExt::defaultTheme"), id: "default"}].addAll(secureReadAll(finTheme).toRecList)) (x,i) =>
      if(x->id == userinfo.find(v => v->property == "theme")->val) i

    lang = eachWhile(finUserLanguages()) (x,i) => //[{dis: toLocale("finStackMobileExt::english"), id: "default"}].addAll(secureReadAll(finLanguage).toRecList)
      if(x->id == userinfo.find(v => v->property == "language")->val) i

    admin = userinfo.find(v => v->property == "userType")->val

  end

  body: [
    {
      name: "username",
      editorType: "textinput",
      prompt: toLocale("finStackExt::settingsMenuUsername")+":",
      defVal: name
    },

    {
      name: "firstname",
      editorType: "textinput",
      prompt: "First Name:",
      defVal: first
    },

    {
      name: "lastname",
      editorType: "textinput",
      prompt: "Last Name:",
      defVal: last
    },

    {
      name: "userRole",
      editorType: "combobox",
      prompt: "User Role:",
      dataProvider: roles.toAxonCode,
      labelField: "dis",
      selectedValueTags: "val",
      defIndex: roleDef
    },

    {
      name: "projAccess",
      editorType: "list",
      listType: "checkbox",
      dataProvider: projects.toRecList.toAxonCode, "projs()", //[{id: \"all\", dis: \"All Projects\", all}].addAll(
      labelField: "dis",
      selectedValueTags: "name",
      height: 85,
      defValTagName: "selected"
    },

    {
      name: "theme",
      editorType: "combobox",
      prompt: toLocale("finStackMobileExt::newUserTheme")+":",
      dataProvider: "[{dis: toLocale(\"finStackMobileExt::defaultTheme\"), id: \"default\"}].addAll(secureReadAll(finTheme).toRecList)",
      labelField: "dis",
      selectedValueTags: "id",
      defIndex: theme
    },

    {
      name: "language",
      editorType: "combobox",
      prompt: toLocale("finStackMobileExt::newUserLanguage")+":",
      dataProvider: "finUserLanguages()",
      labelField: "dis",
      selectedValueTags: "locale",
      defIndex: lang
    },

    {
      name: "options",
      editorType: "list",
      listType: "checkbox",
      prompt: toLocale("finStackMobileExt::newUserOptions"),
      dataProvider: optionList.toAxonCode,
      defValTagName: "selected",
      height: 125,
      labelField: "dis",
      selectedValueTags: "name"
    },

    {
      name: "reverseMagic",
      editorType: "checkbox",
      label: toLocale("finStackMobileExt::reverseMB"),
      defVal: magicDef
    },

    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: "Next", controlBar: true}
  ]

  headerProp: ""
  if(readCount(finHeader) > 0 and not read(finHeader).has("disable")) do
    body = body.add({name: "customHead", editorType: "checkbox", label: toLocale("finStackMobileExt::customHeaderAsDefault"), defVal: false})
    headerProp = ", {property: \"customHeaderDefault\", val: \$customHead}"
  end

  if(userinfo != null)
    body = body.insert(0, {name: "errmsg", editorType: "label", text: toLocale("finStackMobileExt::newUserRequiredItems")})

  { "dis": toLocale("finStackMobileExt::createNewUser"),
  "name": if(userinfo == null) "usersFormCreateNew" else "usersFormCreateNew" + random(1..10000),
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "if(\$username.isEmpty or \$firstname.isEmpty or \$lastname.isEmpty or \$pass.isEmpty or \$confirmPass.isEmpty or \$pass != \$confirmPass) " +
                    "usersFormCreateNew(\$options, [{property: \"username\", val: \$username},{property: \"firstname\", val: \$firstname},{property: \"lastname\", val: \$lastname}," +
                      "{property: \"theme\", val: \$theme},{property: \"language\", val: \$language},{property: \"userType\", val: \$userType}," +
                      "{property: \"pass\", val: \$pass}, {property: \"confirmPass\", val: \$confirmPass}]) " +
                  "else usersFormCreateNewOptions(\$options, [{property: \"username\", val: \$username},{property: \"firstname\", val: \$firstname},{property: \"lastname\", val: \$lastname}," +
                    "{property: \"theme\", val: \$theme},{property: \"language\", val: \$language},{property: \"userType\", val: \$userType}," +
                    "{property: \"pass\", val: \$pass}, {property: \"confirmPass\", val: \$confirmPass}, {property:\"reverseMagic\", val: \$reverseMagic}"+headerProp+"])",
  "completeAction": "if(!\$username){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::usernameRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }"+
                    "else if(!\$firstname){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::firstNameRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }"+
                    "else if(!\$lastname){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::lastNameRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }"+
                    "else if(!\$pass){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::passwordRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }"+
                    "else if(!\$confirmPass){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::passwordConfRequiredPrompt")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }"+
                    "else if(\$pass != \$confirmPass){ app.push('notifications', {message: '"+toLocale("finStackMobileExt::confPasswordMismatch")+"', icon: 'icon-alarm', iconStyle:'color: red'}); }",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormCreateNewCommit ​

usersFormCreateNewCommit(properties, optionals) ​

Axon function


meta ​

deffunc:usersFormCreateNewCommit
isfunc
liblib:finStackMobile
nameusersFormCreateNewCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(properties, optionals) => do
  projFilter: ""

  //set project access
  if(not properties->projAccessFilter.isEmpty()) projFilter = properties->projAccessFilter.map(r => "name=="+r.toAxonCode).concat(" or ")

  if(properties.find(v => v->property == "language")->val != "default")
    newuser = newuser.set("language", properties.find(v => v->property == "language")->val)
  if(properties.find(v => v->property == "theme")->val != "default")
    newuser = newuser.set("finThemeRef", properties.find(v => v->property == "theme")->val)
  if(properties.find(v => v->property == "userType")->val == true)
    newuser = newuser.set("userAdmin", marker())
  if((not optionals.isEmpty and optionals.find(v => v->property == "actionAccessFilter") == null) or optionals.isEmpty())
    newuser = newuser.set("actionAccessFilter", "hvac_finCat <= 6")
  if(properties.find(v=> v->property == "reverseMagic")->val) newuser = newuser.set("reverseMagicBubbles",marker())
  else newuser = newuser.set("reverseMagicBubbles",removeMarker())
  customHeader: properties.findAll(v=> v->property == "customHeaderDefault")
  if(customHeader.size > 0 and customHeader[0]->val) newuser = newuser.set("customHeaderDefault",marker())

  optionals.each x=> do
    if(x->property != "pass" and x->property != "confirmPass" and x->property != "markers" and x->property != "props" and x->property != "actionAccessFilter")
      newuser = newuser.set(x->property, x->val)
    else if(x->property == "markers")
      x->val.split(",").each y => newuser = newuser.set(y, marker())
    else if(x->property == "props") do
      try newuser = newuser.merge(eval("{"+x->val+"}"))
      catch do
        newDictStr: x->val

        x->val.split(",").each prop => do
          try eval("{"+prop+"}")
          catch do
            propVal: prop.split(":")[1..-1].concat(":")
            newDictStr = newDictStr.replace(propVal, propVal.toAxonCode)
          end
        end

        newuser = newuser.merge(eval("{"+newDictStr+"}"))
      end//end catch
    end else if(x == "actionAccessFilter")
      newuser = newuser.set("actionAccessFilter", "hvac_finCat <= " + optionals[x])
  end

  password: optionals.findAll(v => v->property == "pass")

  if(newuser["tz"] == null) newuser = newuser.set("tz", tz())

  newuser = newuser.set("userAuth", finGenScram())
  userRec: userNew(newuser)[0]

  if(password.size > 0)
    userSetPassword(userRec->username, password)  //change to if (password.size > 0)
end


def ​

func:usersFormCreateNewOptions ​

usersFormCreateNewOptions(options, propertyList) ​

Axon function


meta ​

deffunc:usersFormCreateNewOptions
isfunc
liblib:finStackMobile
nameusersFormCreateNewOptions
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(options, propertyList) => do
  accessFilters: [
    {dis: toLocale("finStackMobileExt::actionAccessFilter"), name: "actionAccessFilter"}, {dis: toLocale("finStackMobileExt::scheduleAccessFilter"), name: "scheduleAccessFilter"},
    {dis: toLocale("finStackMobileExt::finProjectAccessFilter"), name: "finProjectAccessFilter"}, {dis: toLocale("finStackMobileExt::programAccessFilter"), name: "programAccessFilter"},
    {dis: toLocale("finStackMobileExt::siteAccessFilter"), name: "siteAccessFilter"}, {dis: toLocale("finStackMobileExt::floorAccessFilter"), name: "floorAccessFilter"},
    {dis: toLocale("finStackMobileExt::equipAccessFilter"), name: "equipAccessFilter"}, {dis: toLocale("finStackMobileExt::pointAccessFilter"), name: "pointAccessFilter"}
  ]
  choices: []
  nextStep: ""
  checkHome: false
  spacer: {name: "spacer", editorType: "label"}

  body: [
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: "Next", controlBar: true}
  ]

  if(refill != null and refill["accessFilters"] != null) accessFilters = accessFilters.map(r => if(refill->accessFilters.contains(r->name)) r.set("selected", marker()) else r)

  if(not options.isEmpty()) do
    options.each x => do
      idxLoc: if(body.size < 3) 2 else 3
      if(x == "tz")
        body = body.addAll([
          {name: "tzSep", editorType: "separator"},
          {
            name: "tz",
            editorType: "combobox",
            prompt: toLocale("finStackMobileExt::timeZone")+":",
            dataProvider: "tzdb().sort(\"fullName\")",
            labelField: "fullName",
            selectedValueTags: "fullName"
          }
        ])
      else if(x == "email")
        body = body.addAll([
          {name: "emailSep", editorType: "separator"},
          {name: "email", editorType: "textinput", prompt: toLocale("finStackMobileExt::userEmail")+":"}
        ])

      else if(x == "imageRef")
        body = body.addAll([
          {name: "impSep", editorType: "separator"},
          {name: "imageRef", editorType: "file", prompt: toLocale("finStackMobileExt::userImage")+":"}
        ])
      else if(x == "finHomePath") do
        body = body.addAll([
          {name: "hPathSep", editorType: "separator"},
          {
            name: "navtree",
            editorType: "ractive",
            ractiveType: "tree",
            prompt: toLocale("finStackMobileExt::elementForGraphics"),
            selectedValueTags: "id",
            path: "treeName:equip"
          },
          {
            name: "finHomePath",
            editorType: "list",
            dataProvider: "readById(\$navtree[0]).finElementOn(\"graphic\")",
            labelField: "dis",
            selectedValueTags: "id",
            prompt: toLocale("finStackMobileExt::gbGraphic")
          }
        ])
      end else if(x == "accessFilters")
        body = body.addAll([
          {name: "accessSep", editorType: "separator"},
          {
            name: x,
            editorType: "list",
            listType: "checkbox",
            prompt: toLocale("finStackMobileExt::chooseAccessFilters"),
            dataProvider: accessFilters.toAxonCode,
            labelField: "dis",
            selectedValueTags: "name"
          }
        ])
      else if(x == "markers")
        body = body.addAll([
          {name: "markersSep", editorType: "separator"},
          {name: "markers", editorType: "textinput", prompt: toLocale("finStackMobileExt::markerTags")+":", defVal: "tag1, tag2"}
        ])
      else if(x == "props")
        body = body.addAll([
          {name: "propsSep", editorType: "separator"},
          {name: "props", editorType: "textinput", prompt: toLocale("finStackMobileExt::propertyTags")+":", defVal: "myNum: 10min, exampleStr: \"someString\""}
        ])

      if(x == "finHomePath") choices = choices.add({property: "\"" + x + "\"", val: "\"#frame?app=graphics&targetRef=@\"+toStr(\$navtree[0])+\"&url=%2Ffin5%2F"+context()->projName+"%3FprojectRef%3D%40\"+toStr(\$finHomePath)+\"%26title%3DshowSettings%23targetRef%3D%40\"+toStr(\$navtree[0])"})
      else choices = choices.add({property: "\"" + x + "\"", val: "\$" + x})
    end
  end else
    body = body.add({name: "emptyLabel", editorType: "label", text: toLocale("finStackMobileExt::noAdditionalUserOpts")})

  if(options.contains("accessFilters")) nextStep = "if((\$accessFilters).isEmpty) userFormSetPassword(" + propertyDict.toAxonCode + ", " + choices + ") else usersAccessFilterWizard(" + propertyDict.toAxonCode + ", " + choices + ")"
  else nextStep = "userFormSetPassword(" + propertyDict.toAxonCode + ", " + choices + ")"

  if(refill != null) body = body.insert(0, {name: "errlabel", editorType: "label", text: "Select a home path by selecting both a graphic and a graphic target."})

  { "dis": toLocale("finStackMobileExt::createNewUserOpts"),
    "name": "usersFormCreateNewOptions" + (if(refill != null) random(0..1000)),
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": if(checkHome) "if((\$navtree).isEmpty or (\$finHomePath).isEmpty) usersFormCreateNewOptions("+options.toAxonCode+", " +propertyDict.toAxonCode+", "+choices.remove("finHomePath")+") else " + nextStep  else nextStep,
    "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})

end


def ​

func:usersFormEdit ​

usersFormEdit(id, editList: null, previousList: null) ​

Axon function


meta ​

deffunc:usersFormEdit
isfunc
liblib:finStackMobile
nameusersFormEdit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, editList:null, previousList: null) => do
  //---Vars---//
  user: userReadById(id)
  themeIndex: 0
  langIndex: 0
  tzIndex: 0
  nextStep: ""
  addOpts: false
  passAndEmail: []
  choices: {}
  spacer: {name: "empty", editorType: "label"}
  postEdit: editList != null and editList.contains("actionAccessFilter")
  standardProps: ["mod", "created","dis","id","userSalt","user","appAccess","finAppAccess", "mobileAppSet", "topicsEmailImmediate", "topicsEmailDigest"]
  ignoreList: [
    "tz","email","pass","imageRef","finHomePath","actionAccessFilter","scheduleAccessFilter","finProjectAccessFilter","programAccessFilter","siteAccessFilter",
    "finAppAccess","mobileAppSet","created","topicsEmailImmediate","topicsEmailDigest","floorAccessFilter","equipAccessFilter","pointAccessFilter","markers",
    "props","username","firstName","lastName","userType","finThemeRef","finLanguageRef","id","mod","dis","userSalt","appAccess","language"
  ]
  accessList: [
    {dis: toLocale("finStackMobileExt::scheduleAccessFilter"), name: "scheduleAccessFilter"}, {dis: toLocale("finStackMobileExt::finProjectAccessFilter"), name: "finProjectAccessFilter"},
    {dis: toLocale("finStackMobileExt::programAccessFilter"), name: "programAccessFilter"}, {dis: toLocale("finStackMobileExt::siteAccessFilter"), name: "siteAccessFilter"},
    {dis: toLocale("finStackMobileExt::floorAccessFilter"), name: "floorAccessFilter"}, {dis: toLocale("finStackMobileExt::equipAccessFilter"), name: "equipAccessFilter"},
    {dis: toLocale("finStackMobileExt::pointAccessFilter"), name: "pointAccessFilter"}
  ]

  usrMrkrTgs: readAllTagNames(parseFilter("id == " + id.toAxonCode))
    .findAll(v => v->kind == "Marker" and v->name != "user" and v->name != "userAdmin" and v->name != "reverseMagicBubbles")
    .toRecList.map(row => row->name)

  usrProps: readAllTagNames(parseFilter("id == " + id.toAxonCode))
    .findAll(v => v->kind != "Marker" and ignoreList.find(w => w == v->name) == null)
    .toRecList.map(row => row->name + ": " + user[row->name].toAxonCode)

  body: [
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

//---Main---//
  if(user.has("finThemeRef")) do
    themeIndex = eachWhile(secureReadAll(finTheme))((x, i) => if(x->id == user->finThemeRef) i)
    if(themeIndex == null) themeIndex = 0
    else themeIndex = themeIndex + 1
  end

  if(user.has("language")) do
    langIndex = finUserLanguages().map(r => r->locale).index(user->language)
    if(langIndex == null) langIndex = 0
  end

  if(user.has("tz")) do
    tzIndex = eachWhile(tzdb().sort("fullName"))((x, i) => if(x->fullName == user->tz) i)
    if(tzIndex == null) tzIndex = 0
  end

  if(previousList != null) previousList.names.each k => choices = choices.set(k, previousList[k].toAxonCode)

  if(editList == null) do
    body = body.addAll(userEditUiList("nameInfo", {userId: id}))
    standardProps.addAll(usrMrkrTgs).addAll(usrProps.map(r => r.split(":")[0])).each(x => user = user.remove(x))
    editList = user.merge({-userAdmin, -username, -reverseMagicBubbles}).names
    addOpts = true
  end

  each(editList) (x, i) => do
    if(x == "tz") body = body.addAll(userEditUiList(x, {tzIdx: tzIndex}))
    else if(x == "email") do
      body = body.addAll(userEditUiList(x, {userId: id}))
      passAndEmail = passAndEmail.add({property: "\"" + x + "\"", val: "\$" + x})
    else if(x == "finThemeRef") body = body.addAll(userEditUiList(x, {themeIdx: themeIndex}))
    else if(x == "language") body = body.addAll(userEditUiList(x, {langIdx: langIndex}))
    else if(x == "pass") do
      body = body.addAll(userEditUiList(x, {}))
      passAndEmail = passAndEmail.addAll([
        {property: "\"" + x + "\"", val: "\$" + x},
        {property: "\"confirmPass\"", val: "\$confirmPass"}
      ])
      choices = choices.set("confirmPass", "\$confirmPass")
    else if(x == "finHomePath") do
      body = body.addAll(userEditUiList(x, {userId: id}))

      if(user.has("finHomePath")) choices = choices.set("finHomePath","\$fHPath")
      else choices = choices.set("homenavtree","\$homenavtree").set("finHomePath", "\$finHomePath")

    end else if(x == "actionAccessFilter") do
      body = body.add({name: "actionAccessSep", editorType: "separator", label: "Action Access Filters"})
      stuff: ""

      try stuff = user->actionAccessFilter
      catch postEdit = true

      if(postEdit) stuff = readAll(finCategory).colToList("name").concat(" <= 6 or ")+" <= 6"

      stuff = stuff.replace(" or ",toChar(8)).split(toChar(8))
      stuff = stuff.map(stu=> {name: stu.split("_")[0], val: stu.split("=")[1].parseInt})
      cou: 0

      stuff.each stu=> do
        body = body.add({name: "actionAccess"+stu->name+"Filter", editorType: "numericstepper",
        minVal: 1, maxVal: 10,prompt: stu->name, defVal: stu->val}) //"Action Access Filter: "+
        choices = choices.set("actionAccess"+stu->name+"Filter", "[\$actionAccess"+stu->name+"Filter]")
        cou = cou + 1
      end
      body = body.add(spacer)
      x = "nope"
    end else if(x.contains("AccessFilter") and x != "actionAccessFilter") body = body.addAll(userEditUiList(x, {accessLst: accessList, userId: id}))
    else if(x == "headerFilter") body = body.add({name: x, editorType: "filter", prompt: toLocale("finStackMobileExt::headerAccessFilter"), defVal: try user->headerFilter catch ""})

    if(x != "nope" and x != "finHomePath") choices = choices.set(x, "\$" + x)
  end

  if(passAndEmail.isEmpty) passAndEmail = passAndEmail.add({property: "\"none\"", val: 0})

  if(addOpts) do
    body = body.addAll(userEditUiList("options", {userId: id, markers: usrMrkrTgs, props: usrProps}))
    choices = choices.merge({markers: "\$markers", props: "\$props", userType: "\$userType", firstName: "\$firstName", lastName: "\$lastName", reverseMagic:"\$reverseMagic"})

    try
      if(not read(finHeader).has("disable")) choices = choices.merge({customHeaderDefault:"if(\$customHead) marker() else removeMarker()"})
    catch 0

    notPresent: []
    optionList: [
      {dis: toLocale("finStackMobileExt::timeZone"), name: "tz"}, {dis: toLocale("finStackMobileExt::userEmail"), name: "email"},
      {dis: toLocale("finStackExt::settingsMenuPassword"), name: "pass"}, //{dis: "User-Image", name: "imageRef"},
      {dis: toLocale("finStackMobileExt::homePath"), name: "finHomePath"}, {dis: toLocale("finStackMobileExt::actionAccessFilter"), name: "actionAccessFilter"},
      {dis: toLocale("finStackMobileExt::scheduleAccessFilter"), name: "scheduleAccessFilter"}, {dis: toLocale("finStackMobileExt::finProjectAccessFilter"), name: "finProjectAccessFilter"},
      {dis: toLocale("finStackMobileExt::programAccessFilter"), name: "programAccessFilter"},{dis: toLocale("finStackMobileExt::siteAccessFilter"), name: "siteAccessFilter"},
      {dis: toLocale("finStackMobileExt::floorAccessFilter"), name: "floorAccessFilter"}, {dis: toLocale("finStackMobileExt::equipAccessFilter"), name: "equipAccessFilter"},
      {dis: toLocale("finStackMobileExt::pointAccessFilter"), name: "pointAccessFilter"}, {dis: toLocale("finStackMobileExt::newUserTheme"), name: "finThemeRef"},
      {dis: toLocale("finStackMobileExt::newUserLanguage"), name: "language"}, {dis: toLocale("finStackMobileExt::headerAccessFilter"), name: "headerFilter"}
    ]

    optionList.each x => if(editList.find(v => v == x->name) == null) notPresent = notPresent.add(x)

    if(notPresent.find(x=> x->name == "actionAccessFilter") == null) notPresent = notPresent.add({dis: toLocale("finStackMobileExt::actionAccessFilter"), name: "actionAccessFilter"})

    body = body.add({
      name: "whatToEdit",
      editorType: "list",
      listType: "checkbox",
      dataProvider: notPresent.sort.toAxonCode,
      prompt: toLocale("finStackMobileExt::selectPropsToAdd")+":",
      labelField: "dis",
      selectedValueTags: "name",
      height: 250
    })

    nextStep = "if(\$whatToEdit.isEmpty) usersInputValidator(" + choices + ", " + passAndEmail + ", null, " + id.toAxonCode + ") else usersFormEdit(" + id.toAxonCode + ", \$whatToEdit, " + choices + ")"
  end else nextStep = "usersInputValidator(" + choices + ", " + passAndEmail + ", null, " + id.toAxonCode + ")"

  { "dis": toLocale("finStackMobileExt::editUser")+": " + user->username,
    "name": if(previousList == null) "usersFormEdit" else "usersFormEdit" + random(1..10000),
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": nextStep,
    "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'userDetail', {funcCall: 'userDetailMenu(" + id.toAxonCode + ")', hideBackButton: true})",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormEditCommit ​

usersFormEditCommit(newSettings, id) ​

Axon function


meta ​

deffunc:usersFormEditCommit
isfunc
liblib:finStackMobile
nameusersFormEditCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(newSettings, id) => do
  user: userReadById(id)
  newMarkerTags: if(newSettings.has("markers")) newSettings->markers.split(",").map(r => r.trim) else null
  newPropertyTags: if(newSettings.has("props")) newSettings->props else null //.split(",").map(r => r.trim) else null
  ignoreList: ["tz", "email","pass","imageRef","finHomePath","actionAccessFilter","scheduleAccessFilter","finProjectAccessFilter","programAccessFilter","siteAccessFilter","finAppAccess",
               "mobileAppSet", "created", "topicsEmailImmediate", "topicsEmailDigest", "floorAccessFilter","equipAccessFilter","pointAccessFilter","markers","props","username","firstName",
               "lastName","userType","finThemeRef","finLanguageRef", "id", "mod", "dis", "userSalt", "appAccess", "language"]

  if(newMarkerTags!= null and newMarkerTags.size == 1 and newMarkerTags[0] == "")
    newMarkerTags = []
  //if(newPropertyTags != null and newPropertyTags.split(",").size == 1 and newPropertyTags.split(",")[0] == "")
    //newPropertyTags = {}

  if(newMarkerTags != null) do
    userMarkerTags: readAllTagNames(parseFilter("id == " + id.toAxonCode)).findAll(v => v->kind == "Marker" and v->name != "user" and v->name != "userAdmin").toRecList.map(row => row->name)
    addMarkers: []
    removeMarks: []

    newMarkerTags.each x => do
      if(userMarkerTags.find(v => v == x) == null) addMarkers = addMarkers.add(x)
    end

    userMarkerTags.each x => do
      if(newMarkerTags.find(v => v == x) == null) removeMarks = removeMarks.add(x)
    end

    addMarkers.each x => newSettings = newSettings.set(x, marker())
    removeMarks.each x => newSettings = newSettings.set(x, removeMarker())
    newSettings = newSettings.remove("markers")
  end

  if(newPropertyTags != null) do
    propsDict: {}
    addProps: []
    removeProps: []
    userPropTags: readAllTagNames(parseFilter("id == " + id.toAxonCode)).findAll(v => v->kind != "Marker" and ignoreList.find(w => w == v->name) == null).colToList("name")

    //make property input a dict
    try propsDict = eval("{"+newPropertyTags+"}") //new
    catch do
      newDictStr: newPropertyTags

      newPropertyTags.split(",").each prop => do
        try eval("{"+prop+"}")
        catch do
          propVal: prop.split(":")[1..-1].concat(":")
          newDictStr = newDictStr.replace(propVal, propVal.toAxonCode)
        end
      end

      propsDict = eval("{"+newDictStr+"}")
    end//end catch

    //remove properties no longer present
    userPropTags.each x => if(propsDict.names.find(v => v == x) == null) removeProps = removeProps.add(x)

    //update the new settings dict
    removeProps.each x => newSettings = newSettings.set(x, removeMarker())
    newSettings = newSettings.remove("props")
    newSettings = newSettings.merge(propsDict)
  end

  if(newSettings.has("finThemeRef") and newSettings->finThemeRef == "default") newSettings = newSettings.set("finThemeRef", removeMarker())

  tmp: newSettings.findAll((z,y)=> y.startsWith("actionAccess") and y.endsWith("Filter") and not y.contains("actionAccessFilter"))

  if(tmp.names.size > 0) do
    actfilt: readAll(finCategory).colToList("name").map(x=> x + " <= 6")
    rez: []
    newactfilt: []

    tmp.each()(z,y)=> do
      rez = rez.add({}.set(y,z))
      newSettings = newSettings.remove(y)
    end

    rez.each x=> do
      n: x.names[0]
      if(x.trap(n).size > 0) newactfilt = newactfilt.add(n[12..-7] +"_finCat <= "+ x.trap(n)[0])
    end

    newactfilt = newactfilt.concat(" or ")
    if(newactfilt.size > 0) newSettings = newSettings.set("actionAccessFilter", newactfilt)
    else newSettings = newSettings.set("actionAccessFilter", removeMarker())
  end

  if(newSettings.has("userType") and newSettings->userType) newSettings = newSettings.set("userAdmin", marker())
  else if(newSettings.has("userType") and not newSettings->userType) newSettings = newSettings.set("userAdmin", removeMarker())

  if(newSettings.has("lastName") or newSettings.has("firstName")) do
    if(newSettings.has("lastName") and newSettings.has("firstName")) newSettings = newSettings.set("dis", newSettings->firstName + " " + newSettings->lastName)
    else if(newSettings.has("lastName")) newSettings = newSettings.set("dis", user->firstName + " " + newSettings->lastName)
    else if(newSettings.has("firstName")) newSettings = newSettings.set("dis", newSettings->firstName + " " + user->lastName)
  end

  if(newSettings.has("homenavtree")) do
    asdf: newSettings->homenavtree

    if(asdf.size > 0) do
      asdf = asdf[0]
    newSettings = newSettings.set("finHomePath","#frame?app=graphics&targetRef=@"+toStr(asdf)+"&url=%2Ffin5%2F"+context()->projName+
        "%3FprojectRef%3D%40"+toStr(newSettings->finHomePath)+"%26title%3DshowSettings%23targetRef%3D%40"+toStr(asdf))
  end

    newSettings = newSettings.remove("homenavtree")
  end else if(newSettings.has("finHomePath") and newSettings->finHomePath.trim.isEmpty()) newSettings = newSettings.set("finHomePath", removeMarker())

  password: null

  if(newSettings.has("pass")) do
    password = newSettings->pass
    newSettings = newSettings.remove("pass").remove("confirmPass")
  end

  if(newSettings.has("reverseMagic")) do
    if(newSettings->reverseMagic) newSettings = newSettings.set("reverseMagicBubbles",marker())
  else newSettings = newSettings.set("reverseMagicBubbles",removeMarker())
    newSettings = newSettings.remove("reverseMagic")
  end

  if(newSettings.has("email") and newSettings->email.isEmpty())
    newSettings = newSettings.set("email", removeMarker())

  user = userEdit(user.merge(newSettings))[0]
  if(newSettings.has("username") and newSettings["username"] != user["username"]) do
      userDelete(user->id)
      user = user.remove("id")
      user = userNew(user.merge(newSettings))[0]
  else do
      newSettings = newSettings.remove("username")
      user        = user.remove("username")
      user = userEdit(user.merge(newSettings))[0]
  end

  user = userReadById(user->id) //reload new userinfo
  if(password != null)
      userSetPassword(user->username, password)

  finFormAlertOk(toLocale("finStackExt::bLineSuccess"), toLocale("finStackMobileExt::userUpdated").replace("{username}", user->username))
end


def ​

func:usersFormSelectEdit ​

usersFormSelectEdit(id) ​

Axon function


meta ​

deffunc:usersFormSelectEdit
isfunc
liblib:finStackMobile
nameusersFormSelectEdit
obsolete✓
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  optionList: [
    {dis: toLocale("finStackMobileExt::timeZone"), name: "tz"},
    {dis: toLocale("finStackMobileExt::userEmail"), name: "email"},
    {dis: toLocale("finStackExt::settingsMenuPassword"), name: "pass"},
    {dis: toLocale("finStackMobileExt::userImage"), name: "imageRef"},
    {dis: toLocale("finStackMobileExt::homePath"), name: "finHomePath"},
    {dis: toLocale("finStackMobileExt::actionAccessFilter"), name: "actionAccessFilter"},
    {dis: toLocale("finStackMobileExt::scheduleAccessFilter"), name: "scheduleAccessFilter"},
    {dis: toLocale("finStackMobileExt::finProjectAccessFilter"), name: "finProjectAccessFilter"},
    {dis: toLocale("finStackMobileExt::programAccessFilter"), name: "programAccessFilter"},
    {dis: toLocale("finStackMobileExt::siteAccessFilter"), name: "siteAccessFilter"},
    {dis: toLocale("finStackMobileExt::floorAccessFilter"), name: "floorAccessFilter"},
    {dis: toLocale("finStackMobileExt::equipAccessFilter"), name: "equipAccessFilter"},
    {dis: toLocale("finStackMobileExt::pointAccessFilter"), name: "pointAccessFilter"},
    {dis: toLocale("finStackMobileExt::markerTags"), name: "markers"},
    {dis: toLocale("finStackMobileExt::propertyTags"), name: "props"},
    {dis: toLocale("finStackExt::settingsMenuUsername"), name: "username"},
    {dis: toLocale("finStackMobileExt::userFuncsFirstName"), name: "firstName"},
    {dis: toLocale("finStackMobileExt::userFuncsLastName"), name: "lastName"},
    {dis: toLocale("finStackMobileExt::userType"), name: "userType"},
    {dis: toLocale("finStackMobileExt::newUserTheme"), name: "finThemeRef"},
    {dis: toLocale("finStackMobileExt::newUserLanguage"), name: "finLanguageRef"}
  ]

   body: [
    {
      name: "whatToEdit",
      editorType: "list",
      listType: "checkbox",
      dataProvider: optionList.sort.toAxonCode,
      prompt: toLocale("finStackMobileExt::selPropsYouToEdit")+":",
      labelField: "dis",
      selectedValueTags: "name",
      height: 250
    },

    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  { "dis": toLocale("finStackMobileExt::editUser"),
    "name": "usersFormSelectEdit",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "usersFormEdit(" + id.toAxonCode + ", \$whatToEdit)",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormSubscriptions ​

usersFormSubscriptions(id) ​

Axon function


meta ​

deffunc:usersFormSubscriptions
isfunc
liblib:finStackMobile
nameusersFormSubscriptions
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do
  user: userReadById(id)
  digest: []
  immediate: []
  subscripts: secureReadAll(topic and not sparkTopic)
  subList: []
  subscriptionList: []

  if(user.has("topicsEmailDigest")) digest = user->topicsEmailDigest.split(",")
  if(user.has("topicsEmailImmediate")) immediate = user->topicsEmailImmediate.split(",")

  subscripts.each x => do
    temp: {id: x->id, dis: x.dis}

    if(digest.contains("@" + x->id)) temp = temp.set("digest", true)
    else temp = temp.set("digest", false)

    if(immediate.contains("@" + x->id)) temp = temp.set("immediate", true)
    else temp = temp.set("immediate", false)

    subList = subList.add(temp)
  end
  //echo(subList)
  body: [
    /*{
      name: "subscriptionList",
      editorType: "list",
      prompt: toLocale("finStackMobileExt::setSubsSettingsPhrase")+" " + user.dis,
      dataProvider: subList.toAxonCode,
      itemRenderer:[
        {name: "topic", editorType: "label", text: "\$dis"},
        {name: "digest", editorType: "checkbox", label: toLocale("finStackMobileExt::userFuncsDigest")},
        {name: "immediate", editorType: "checkbox", label: toLocale("finStackMobileExt::userFuncsImmediate")},
      ]
    },*/

  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  subList.each x => do
    disVal: x.dis.decapitalize.replace(" ", "")
    body = body.add({
      name: disVal + "group",
      editorType: "group",
      prompt: x.dis,
      horizontal: marker(),
      children: [
        {name: disVal + "Digest", editorType: "checkbox", label: toLocale("finStackMobileExt::userFuncsDigest"), defVal: x->digest},
        {name: disVal + "Immediate", editorType: "checkbox", label: toLocale("finStackMobileExt::userFuncsImmediate"), defVal: x->immediate}
      ]
    })

    subscriptionList = subscriptionList.add({topic: "\"" + x.dis + "\"", digest: "\$" + disVal + "Digest", immediate: "\$" + disVal + "Immediate"})
  end

  { "dis": toLocale("finStackMobileExt::setUserSubs"),
  "name": "userSubscriptions",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "usersFormSubscriptionsCommit(" + subscriptionList + ", " + id.toAxonCode + ")", //readById(id).toAxonCode + ".diff({}, {remove}).commit",
  "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:usersFormSubscriptionsCommit ​

usersFormSubscriptionsCommit(newSubs, id) ​

Axon function


meta ​

deffunc:usersFormSubscriptionsCommit
isfunc
liblib:finStackMobile
nameusersFormSubscriptionsCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(newSubs, id) => do
  allTopics: secureReadAll(topic and not sparkTopic)
  digest: ""
  immediate: ""

  newSubs.each x => do
    curId: allTopics.find(v => v->dis == x->topic)->id
    if(x->immediate) immediate = immediate + curId.toAxonCode + ","
    if(x->digest) do
      digest = digest + curId.toAxonCode + ","
      try do
        tmp: read(ext==curId.toRec->topicOn)
        if(not tmp.has("digestTime")) tmp.diff({digestTime: time(6,0)}).commit
      end catch null
    end
  end

  temp: {}

  if(digest != "")
    temp = temp.set("topicsEmailDigest", digest[0..-2])
  else
    temp = temp.set("topicsEmailDigest", removeMarker())

  if(immediate != "")
    temp = temp.set("topicsEmailImmediate", immediate[0..-2])
  else
    temp = temp.set("topicsEmailImmediate", removeMarker())

  userReadById(id).diff(temp).commit
end


def ​

func:usersInputValidator ​

usersInputValidator(properties, optionals, newVals: null, id: null) ​

Axon function


meta ​

deffunc:usersInputValidator
isfunc
liblib:finStackMobile
nameusersInputValidator
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(properties, optionals, newVals: null, id: null) => do
  if(newVals != null and newVals.has("pass"))
    optionals = optionals.map(r => if(r->property == "pass") r.set("val", newVals->pass) else if(r->property == "confirmPass") r.set("val", newVals->confirmPass) else r)
  else if(newVals != null and newVals.has("email"))
    optionals = optionals.map(r => if(r->property == "email") r.set("val", newVals->email) else r)

  /*----check password----*/
  password: optionals["pass"] //.findAll(v => v->property == "pass")
  confirmPass: null

  if(password != null) do
    //password = password[0]->val
    confirmPass = optionals->confirmPass //.find(v => v->property == "confirmPass")->val
    if(password != confirmPass) do
      body: [
        {name: "errmsg", editorType: "label", prompt: toLocale("finStackMobileExt::confPasswordMisatch")},
        {name: "pass", editorType: "textinput", prompt: toLocale("finStackExt::settingsMenuPassword")+":", password: true},
        {name: "confirmPass", editorType: "textinput", prompt: toLocale("finStackMobileExt::passForm.confirmPassword")+":", password: true},
        {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
        {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
      ]

      return { "dis": toLocale("finStackExt::regError"),
      "name": "userPassWord" + random(1..10000),
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "usersInputValidator(" + properties.toAxonCode + ", " + optionals.toAxonCode + ", {password, pass: \$pass, confirmPass: \$confirmPass}, " + id.toAxonCode + ")",
      "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
      "finForm": marker()
      }.toGrid.addMeta({formExecute: marker()})
    end
  end

  emailStr: optionals["email"] //.findAll(v => v->property == "email")

  if(email.size > 0) do
    if(not email[0]->val.isEmpty() and not finValidateEmail(email[0]->val)) do
      body: [
        {name: "errmsg", editorType: "label", prompt: toLocale("finStackMobileExt::emailInvalid")},
        {name: "email", editorType: "textinput", prompt: toLocale("finStackMobileExt::reportsExport")+":", defVal: email[0]->val},
        {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
        {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
      ]

      return { "dis": toLocale("finStackExt::regError"),
      "name": "userEmail" + random(1..10000),
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "usersInputValidator(" + properties.toAxonCode + ", " + optionals.toAxonCode + ", {email: \$email}, " + id.toAxonCode + ")",
      "completeAction": "window.app.ObtainMenu(null, '{{targetRef}}', 'users'," + usersMainMenuSettings().toAxonCode + ")",
      "finForm": marker()
      }.toGrid.addMeta({formExecute: marker()})
   end
   else
     properties = properties.set("email", email[0]->val)
  end

  if(id != null) do
    if(password.size > 0)
      properties = properties.set("pass", password)
    if(email.size > 0)
      properties = properties.set("email", email[0]->val)

    usersFormEditCommit(properties, id)
  end else
    usersFormCreateNewCommit(properties, optionals)
end


def ​

func:usersMainMenuSettings ​

usersMainMenuSettings(id: null) ​

Axon function


meta ​

deffunc:usersMainMenuSettings
isfunc
liblib:finStackMobile
nameusersMainMenuSettings
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id:null) => do
  settings:{
    funcCall: "usersMenu()",
    display: "dis",
    //header: toLocale("finStackMobileExt::rightMenuUsers"),
    icon: "icon-user",
    iconType: "class",
    iconTooltip: "{username}'+'-'+'{email}",
    hasBadge: true,
    keepOpen: true,
    badgeValueFunc: "usersType()",
    badgeType: "normal",
    action: "openMenu:null, '{{targetRef}}', 'userDetail', {funcCall: 'userDetailMenu(@*~id*)', hideBackButton: true}",
    hideBackButton: true
  }
end


def ​

func:usersRunTool ​

usersRunTool(funcName, id) ​

Axon function


meta ​

deffunc:usersRunTool
isfunc
liblib:finStackMobile
nameusersRunTool
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(funcName, id) => do
  funcName = funcName.toStr
  pos: funcName.index("(")

  funcName = funcName[0..(pos - 1)]

  try
    eval(funcName + "(" + id.toAxonCode + ", [" + userReadById(id).toAxonCode + "])")
  catch
    eval(funcName + "()")
end


def ​

func:usersToolSettings ​

usersToolSettings(id: null) ​

Axon function


meta ​

deffunc:usersToolSettings
isfunc
liblib:finStackMobile
nameusersToolSettings
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id:null) => do
  toolSettings: {
    funcCall: "userGetTools(" + id.toAxonCode + ")",
    display: "dis",
    hideBackButton: true,
    keepOpen: true,
    folderPathCount:0,
    action: "func:usersRunTool({name}," + id.toAxonCode + ")"
  }
end


def ​

func:usersType ​

usersType(item) ​

Axon function


meta ​

deffunc:usersType
isfunc
liblib:finStackMobile
nameusersType
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(item) => do
  if(item.has("userAdmin"))
    return "ADMIN"
  else
    return "USER"
end


def ​

func:weatherForm ​

weatherForm() ​

Axon function


meta ​

deffunc:weatherForm
isfunc
liblib:finStackMobile
nameweatherForm
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

() => do
  body: [
    {
      name: "place",
      editorType: "textinput",
      prompt:
      toLocale("finStackMobileExt::weatherMenuLocationSearch"),
      defVal: "Chino"
    },

    {
      name: "opts",
      editorType: "list",
      prompt: toLocale("finStackMobileExt::weatherMenuPlaces"),
      dataProvider: "try weatherReadLocs(\$place) catch null",
      labelField: "dis",
      selectedValueTags: "disRec,geoCity,geoCoord,geoCountry,geoState,tz",
      toolTip: "wait for this to load"
    },

    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::weatherMenuAdd"), controlBar: true}
  ]

  {
    "dis": toLocale("finStackMobileExt::weatherMenuNewLocation"),
    "name": "weatherForm",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "if(isDict(\$opts)) diff(null, merge(\$opts, {dis: \$opts->disRec, -disRec, weatherStation, weatherAutoSyncHis, weatherAutoSyncForecast, weatherSyncIds: [\"temp\", \"condition\", \"sunrise\", \"humidity\"]}), {add}).commit",
    "completeAction": "window.app.ObtainMenu(null, 'null', 'weather', " + finWeatherSettings("forMenu2").toAxonCode + ")",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})
end