{ "custom": {}, "params": { "parentFolder": "" }, "propConfig": { "params.parentFolder": { "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 300, "width": 400 } }, "root": { "children": [ { "meta": { "name": "Markdown" }, "position": { "height": "calc(100% - 150px)", "width": "calc(100% - 50px)", "x": 25, "y": 60 }, "propConfig": { "props.source": { "binding": { "config": { "struct": { "folderName": "{../TextField.props.text}", "parentFolder": "{view.params.parentFolder}" }, "waitOnAll": true }, "transforms": [ { "code": "\timport os\n\t\n\ttext \u003d \"Are you sure you would like to create the following folder:\\n\"\n\ttext +\u003d \"\\n* \"+os.path.join(value.parentFolder, value.folderName)\n\treturn text", "type": "script" } ], "type": "expr-struct" } } }, "type": "ia.display.markdown" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\timport os\n\t\n\tparentFolder \u003d self.view.params.parentFolder\n\tfolderName \u003d self.getSibling(\"TextField\").props.text\n\tdocuments.createFolder(os.path.join(parentFolder, folderName))\n\tsystem.perspective.sendMessage(\"custom-documents-refreshlist\", {})\n\tsystem.perspective.closePopup(\"\")" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_Yes" }, "position": { "height": 55, "width": 100, "x": 25, "y": 235 }, "propConfig": { "props.enabled": { "binding": { "config": { "path": "../TextField.props.text" }, "transforms": [ { "code": "\tif value \u003d\u003d \"\":\n\t\treturn False\n\t# Only support alphanumeric folder names:\n\treturn \"\".join([c for c in value if c.isalpha() or c.isdigit() or c\u003d\u003d\u0027 \u0027]).strip() \u003d\u003d value", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Yes" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\tsystem.perspective.closePopup(\"\")" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_No" }, "position": { "height": 55, "width": 100, "x": "calc(100% - 125px)", "y": 235 }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "No" }, "type": "ia.input.button" }, { "meta": { "name": "TextField" }, "position": { "height": 32, "width": "calc(100% - 125px)", "x": 115, "y": 10 }, "props": { "deferUpdates": false }, "type": "ia.input.text-field" }, { "meta": { "name": "Label" }, "position": { "height": 32, "width": 110, "y": 10 }, "props": { "style": { "textAlign": "right" }, "text": "Folder Name:" }, "type": "ia.display.label" }, { "meta": { "name": "Label_BadFolderName" }, "position": { "height": 12, "width": 250, "x": 120, "y": 42 }, "propConfig": { "meta.visible": { "binding": { "config": { "expression": "!{../Button_Yes.props.enabled}" }, "type": "expr" } } }, "props": { "style": { "color": "red", "fontSize": "12px" }, "text": "* Empty or contains invalid characters" }, "type": "ia.display.label" } ], "meta": { "name": "root" }, "type": "ia.container.coord" } }