-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imported all attribute-types, exported string-dropdown
- Loading branch information
1 parent
0bac593
commit b87d440
Showing
6 changed files
with
731 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div class="sc-element"> | ||
@Edit.Toolbar() | ||
<h1> | ||
System Types | ||
</h1> | ||
<div> | ||
this app manages all core data types which we'll distribute from now on... | ||
</div> | ||
|
||
|
||
<div> | ||
Click here | ||
@Edit.Toolbar(actions: "app") | ||
to manage the app | ||
</div> | ||
<div> | ||
start <a href='@Link.To(parameters: "export=1")'>export</a> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 + "'"; | ||
} | ||
} | ||
|
||
} | ||
|
||
<div> | ||
<h3>Stats</h3> | ||
Type Count: @types.Count() <br/> | ||
Export Count: @expCts.Count() <br/> | ||
Selected: @selected <br/> | ||
Target: @target <br/> | ||
Message: @message <br/> | ||
</div> | ||
<br/> | ||
<div> | ||
<h3>List</h3> | ||
<ol> | ||
@foreach(var t in expCts){ | ||
<li>@t.Name - <a href='@Link.To(parameters:"export=1&scope=" + t.Scope + "&name=" + t.Name)'>export</a></li> | ||
} | ||
</ol> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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":{"*":"<p>Type in the values, one per line and separate keys:values with a \":\". </p>\n<p><strong>Example 1</strong><br />\n(none):\n<br />\nLeft:l\n<br />\nRight:r\n<br />\nTop:t</p>\n<p><strong>Example 2</strong><br />\nMIT License:MIT<br />\nGUN Licnese:GNU<br />\nGPL-3 with mentioning of Author:GPL-3-BY</p>"},"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":{"*":"<p>Allow users to type other things than are in the drop-down. Two common situations for this: <ul><li>situations where the drop-down will suggest typical values, but others are also possible</li> <li>Situations where you need tokens like [Parameter:Category] which will later be resolved to a real value</li></ul></p>"},"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":{"*":"<p>To discover more about the drop-down type, consult the <a href=\"https://github.com/2sic/2sxc/wiki/ui-field-string-dropdown\" target=\"_blank\" rel=\"noopener\">wiki</a>.</p>"},"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"}}]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |