From b87d4407eeab14c08d656249e1033c522d1cd8d6 Mon Sep 17 00:00:00 2001 From: iJungleboy Date: Wed, 22 Nov 2017 10:06:20 +0100 Subject: [PATCH] imported all attribute-types, exported string-dropdown --- .data/app.xml | 652 +++++++++++++++++- _default.cshtml | 19 + _dummy.cshtml | 10 - _export.cshtml | 57 ++ .../contenttypes/System.@string-dropdown.json | 1 + readme.md | 6 + 6 files changed, 731 insertions(+), 14 deletions(-) create mode 100644 _default.cshtml delete mode 100644 _dummy.cshtml create mode 100644 _export.cshtml create mode 100644 export/contenttypes/System.@string-dropdown.json create mode 100644 readme.md diff --git a/.data/app.xml b/.data/app.xml index a82370c..26c1c72 100644 --- a/.data/app.xml +++ b/.data/app.xml @@ -1,11 +1,632 @@ - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25,7 +646,7 @@ - + @@ -35,8 +656,8 @@ - - + + @@ -44,6 +665,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_default.cshtml b/_default.cshtml new file mode 100644 index 0000000..9372301 --- /dev/null +++ b/_default.cshtml @@ -0,0 +1,19 @@ +
+ @Edit.Toolbar() +

+ System Types +

+
+ this app manages all core data types which we'll distribute from now on... +
+ + +
+ Click here + @Edit.Toolbar(actions: "app") + to manage the app +
+
+ start export +
+
\ No newline at end of file diff --git a/_dummy.cshtml b/_dummy.cshtml deleted file mode 100644 index 444ac06..0000000 --- a/_dummy.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -
- -

- System Types -

-
- this app manages all core data types which we'll distribute from now on... -
- -
\ No newline at end of file diff --git a/_export.cshtml b/_export.cshtml new file mode 100644 index 0000000..dc38d76 --- /dev/null +++ b/_export.cshtml @@ -0,0 +1,57 @@ +@using ToSic.Eav.Data +@using ToSic.Eav.Interfaces +@using ToSic.Eav.Persistence.File +@using ToSic.Eav.Enums +@using ToSic.Eav.Logging.Simple +@{ + var target = App.PhysicalPath + "\\export\\"; + + // Important: this uses very internal, secret APIs which are prone to change + // Only use for this, don't try to immitate this in your code + // as it will stop working some time in the future + var log = new Log("Exp.Temp"); + var appMan = new ToSic.Eav.Apps.AppRuntime(App.AppId, log); + var types = appMan.Package.ContentTypes; + + // find only the ones we'll export + var expCts = types + .Where(t => { + var ct = (t as ContentType); + return ct.Scope == "System" && !ct.AlwaysShareConfiguration; + }) + .ToList(); + + IContentType selected = null; + string message = ""; + // save step - again using very internal API + var fileSysLoader = new FileSystemLoader(target, Repositories.TestFiles, true, log); + if(!String.IsNullOrEmpty(Request.QueryString["Scope"])) { + selected = expCts.FirstOrDefault(ct => + ct.Scope == Request.QueryString["Scope"] + && ct.Name == Request.QueryString["Name"] + ); + if(selected != null){ + fileSysLoader.SaveContentType(selected); + message = "exported '" + selected.Name + "'"; + } + } + +} + +
+

Stats

+ Type Count: @types.Count()
+ Export Count: @expCts.Count()
+ Selected: @selected
+ Target: @target
+ Message: @message
+
+
+
+

List

+
    + @foreach(var t in expCts){ +
  1. @t.Name - export
  2. + } +
+
\ No newline at end of file diff --git a/export/contenttypes/System.@string-dropdown.json b/export/contenttypes/System.@string-dropdown.json new file mode 100644 index 0000000..b488710 --- /dev/null +++ b/export/contenttypes/System.@string-dropdown.json @@ -0,0 +1 @@ +{"_":{"V":1},"ContentType":{"Id":"@string-dropdown","Name":"@string-dropdown","Scope":"System","Description":"Dropdown string-input configuration","Attributes":[{"Name":"DropdownValues","Type":"String","IsTitle":true,"Metadata":[{"Id":41667,"Version":3,"Guid":"5bd40264-ef9e-4eab-b093-b3b620e8ac63","Type":{"Name":"@All","Id":"@All"},"Attributes":{"String":{"CustomJavaScript":{"*":""},"DefaultValue":{"*":"Example\nExample showing this text, but storing the value 27:27"},"InputType":{"*":"string-default"},"Name":{"*":"Values"},"Notes":{"*":"

Type in the values, one per line and separate keys:values with a \":\".

\n

Example 1
\n(none):\n
\nLeft:l\n
\nRight:r\n
\nTop:t

\n

Example 2
\nMIT License:MIT
\nGUN Licnese:GNU
\nGPL-3 with mentioning of Author:GPL-3-BY

"},"ValidationRegExJavaScript":{"*":""}},"Boolean":{"Disabled":{"*":false},"Required":{"*":false},"VisibleInEditUI":{"*":true}}},"Owner":"dnn:userid=1"},{"Id":41668,"Version":3,"Guid":"ef9d3d36-afdd-4994-be14-701d42f175c3","Type":{"Name":"@String","Id":"@String"},"Attributes":{},"Owner":"dnn:userid=1"},{"Id":41669,"Version":3,"Guid":"ad7b7c85-4eee-400e-beda-a30befb455e4","Type":{"Name":"@string-default","Id":"@string-default"},"Attributes":{"Number":{"RowCount":{"*":12.0}}},"Owner":"dnn:userid=1"}]},{"Name":"EnableTextEntry","Type":"Boolean","IsTitle":false,"Metadata":[{"Id":41679,"Version":4,"Guid":"148087de-0e4a-4003-9909-ea4c548cfa74","Type":{"Name":"@All","Id":"@All"},"Attributes":{"String":{"CustomJavaScript":{"*":""},"DefaultValue":{"*":"false"},"InputType":{"*":"boolean-default"},"Name":{"*":"Enable Free Text"},"Notes":{"*":"

Allow users to type other things than are in the drop-down. Two common situations for this:

  • situations where the drop-down will suggest typical values, but others are also possible
  • Situations where you need tokens like [Parameter:Category] which will later be resolved to a real value

"},"ValidationRegExJavaScript":{"*":""}},"Boolean":{"Disabled":{"*":false},"Required":{"*":false},"VisibleInEditUI":{"*":true}}},"Owner":"dnn:userid=1"},{"Id":41682,"Version":3,"Guid":"8399706a-0a6c-4f58-b816-04a2272295f3","Type":{"Name":"@Boolean","Id":"@Boolean"},"Attributes":{},"Owner":"dnn:userid=1"}]}],"Metadata":[{"Id":41685,"Version":1,"Guid":"8b606bc8-ea55-4c5c-a7cb-d886a6a751b1","Type":{"Name":"ContentType","Id":"ContentType"},"Attributes":{"String":{"Description":{"*":"Dropdown string-input configuration"},"EditInstructions":{"*":"

To discover more about the drop-down type, consult the wiki.

"},"Label":{"*":"@string-dropdown"},"Notes":{"*":""}},"Hyperlink":{"Icon":{"*":""},"Link":{"*":"https://github.com/2sic/2sxc/wiki/ui-field-string-dropdown"}}},"Owner":"dnn:userid=1","For":{"Target":"ContentType","String":"@string-dropdown"}}]}} \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..95150c8 --- /dev/null +++ b/readme.md @@ -0,0 +1,6 @@ +## Development App to Manage System Type + +This app is used in development to design and create system content-types. Examples are + +* @All - the type used to define a field +* @string-dropdown - the type used to configure a drop-down field \ No newline at end of file