improvements to refresh logic, module template enhancements
This commit is contained in:
		| @ -6,25 +6,27 @@ | ||||
| @inherits ModuleBase | ||||
| @inject I[Module]Service [Module]Service | ||||
| @inject NavigationManager NavigationManager | ||||
| @inject IStringLocalizer<Edit> Localizer | ||||
|  | ||||
| <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate> | ||||
| <table class="table table-borderless"> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="name" HelpText="Enter a name">Name: </Label> | ||||
|             <Label For="name" HelpText="Enter a name" ResourceKey="Name">Name: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="name" class="form-control" @bind="@_name" /> | ||||
|             <input id="name" class="form-control" @bind="@_name" required /> | ||||
|         </td> | ||||
|     </tr> | ||||
| </table> | ||||
| <button type="button" class="btn btn-success" @onclick="Save">Save</button> | ||||
| <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> | ||||
| <br /> | ||||
| <br /> | ||||
| <button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button> | ||||
| <NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink> | ||||
| <br /><br /> | ||||
| @if (PageState.Action == "Edit") | ||||
| { | ||||
|     <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo> | ||||
| } | ||||
| </form> | ||||
|  | ||||
| @code { | ||||
|     public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit; | ||||
| @ -38,12 +40,15 @@ | ||||
|         new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } | ||||
|     }; | ||||
|  | ||||
|     int _id; | ||||
|     string _name; | ||||
|     string _createdby; | ||||
|     DateTime _createdon; | ||||
|     string _modifiedby; | ||||
|     DateTime _modifiedon; | ||||
|     private ElementReference form; | ||||
|     private bool validated = false; | ||||
|  | ||||
|     private int _id; | ||||
|     private string _name; | ||||
|     private string _createdby; | ||||
|     private DateTime _createdon; | ||||
|     private string _modifiedby; | ||||
|     private DateTime _modifiedon; | ||||
|  | ||||
|     protected override async Task OnInitializedAsync() | ||||
|     { | ||||
| @ -66,7 +71,7 @@ | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Loading [Module] {[Module]Id} {Error}", _id, ex.Message); | ||||
|             AddModuleMessage("Error Loading [Module]", MessageType.Error); | ||||
|             AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -74,7 +79,9 @@ | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             if (!string.IsNullOrEmpty(_name)) | ||||
|             validated = true; | ||||
|             var interop = new Interop(JSRuntime); | ||||
|             if (await interop.FormValid(form)) | ||||
|             { | ||||
|                 if (PageState.Action == "Add") | ||||
|                 { | ||||
| @ -95,13 +102,13 @@ | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 AddModuleMessage("The Name Is Required", MessageType.Warning); | ||||
|                 AddModuleMessage(Localizer["Message.SaveValidation"], MessageType.Warning); | ||||
|             } | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Saving [Module] {Error}", ex.Message); | ||||
|             AddModuleMessage("Error Saving [Module]", MessageType.Error); | ||||
|             AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -5,6 +5,7 @@ | ||||
| @inherits ModuleBase | ||||
| @inject I[Module]Service [Module]Service | ||||
| @inject NavigationManager NavigationManager | ||||
| @inject IStringLocalizer<Index> Localizer | ||||
|  | ||||
| @if (_[Module]s == null) | ||||
| { | ||||
| @ -12,7 +13,7 @@ | ||||
| } | ||||
| else | ||||
| { | ||||
|     <ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add [Module]" /> | ||||
|     <ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add [Module]" ResourceKey="Add" /> | ||||
|     <br /> | ||||
|     <br /> | ||||
|     @if (@_[Module]s.Count != 0) | ||||
| @ -21,18 +22,18 @@ else | ||||
|             <Header> | ||||
|                 <th style="width: 1px;"> </th> | ||||
|                 <th style="width: 1px;"> </th> | ||||
|                 <th>Name</th> | ||||
|                 <th>@Localizer["Name"]</th> | ||||
|             </Header> | ||||
|             <Row> | ||||
|                 <td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" /></td> | ||||
|                 <td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" /></td> | ||||
|                 <td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" ResourceKey="Edit"  /></td> | ||||
|                 <td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete"  /></td> | ||||
|                 <td>@context.Name</td> | ||||
|             </Row> | ||||
|         </Pager> | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         <p>No [Module]s To Display</p> | ||||
|         <p>@Localizer["Message.DisplayNone"]</p> | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -54,7 +55,7 @@ else | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Loading [Module] {Error}", ex.Message); | ||||
|             AddModuleMessage("Error Loading [Module]", MessageType.Error); | ||||
|             AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -70,7 +71,7 @@ else | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Deleting [Module] {[Module]} {Error}", [Module], ex.Message); | ||||
|             AddModuleMessage("Error Deleting [Module]", MessageType.Error); | ||||
|             AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -1,11 +1,12 @@ | ||||
| @namespace [Owner].[Module] | ||||
| @inherits ModuleBase | ||||
| @inject ISettingService SettingService | ||||
| @inject IStringLocalizer<Settings> Localizer | ||||
|  | ||||
| <table class="table table-borderless"> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="value" HelpText="Enter a value">Name: </Label> | ||||
|             <Label For="value" HelpText="Enter a value" ResourceKey="SettingName">Name: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="value" type="text" class="form-control" @bind="@_value" /> | ||||
|  | ||||
							
								
								
									
										141
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Edit.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Edit.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,141 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|             Microsoft ResX Schema  | ||||
|  | ||||
|             Version 2.0 | ||||
|  | ||||
|             The primary goals of this format is to allow a simple XML format  | ||||
|             that is mostly human readable. The generation and parsing of the  | ||||
|             various data types are done through the TypeConverter classes  | ||||
|             associated with the data types. | ||||
|  | ||||
|             Example: | ||||
|  | ||||
|             ... ado.net/XML headers & schema ... | ||||
|             <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|             <resheader name="version">2.0</resheader> | ||||
|             <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|             <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|             <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|             <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|             <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|                 <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|             </data> | ||||
|             <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|                 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|                 <comment>This is a comment</comment> | ||||
|             </data> | ||||
|  | ||||
|             There are any number of "resheader" rows that contain simple  | ||||
|             name/value pairs. | ||||
|  | ||||
|             Each data row contains a name, and value. The row also contains a  | ||||
|             type or mimetype. Type corresponds to a .NET class that support  | ||||
|             text/value conversion through the TypeConverter architecture.  | ||||
|             Classes that don't support this are serialized and stored with the  | ||||
|             mimetype set. | ||||
|  | ||||
|             The mimetype is used for serialized objects, and tells the  | ||||
|             ResXResourceReader how to depersist the object. This is currently not  | ||||
|             extensible. For a given mimetype the value must be set accordingly: | ||||
|  | ||||
|             Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|             that the ResXResourceWriter will generate, however the reader can  | ||||
|             read any of the formats listed below. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|             value   : The object must be serialized into a byte array  | ||||
|                     : using a System.ComponentModel.TypeConverter | ||||
|                     : and then encoded with base64 encoding. | ||||
|             --> | ||||
|   <xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="Name.Text" xml:space="preserve"> | ||||
|     <value>Name: </value> | ||||
|   </data> | ||||
|   <data name="Name.HelpText" xml:space="preserve"> | ||||
|     <value>Enter the name</value> | ||||
|   </data> | ||||
|   <data name="Save" xml:space="preserve"> | ||||
|     <value>Save</value> | ||||
|   </data> | ||||
|   <data name="Cancel" xml:space="preserve"> | ||||
|     <value>Cancel</value> | ||||
|   </data> | ||||
|   <data name="Message.LoadError" xml:space="preserve"> | ||||
|     <value>Error Loading [Module]</value> | ||||
|   </data> | ||||
|   <data name="Message.SaveValidation" xml:space="preserve"> | ||||
|     <value>Please Provide All Required Information</value> | ||||
|   </data> | ||||
|   <data name="Message.SaveError" xml:space="preserve"> | ||||
|     <value>Error Saving [Module]</value> | ||||
|   </data> | ||||
| </root> | ||||
							
								
								
									
										138
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Index.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Index.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,138 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|             Microsoft ResX Schema  | ||||
|  | ||||
|             Version 2.0 | ||||
|  | ||||
|             The primary goals of this format is to allow a simple XML format  | ||||
|             that is mostly human readable. The generation and parsing of the  | ||||
|             various data types are done through the TypeConverter classes  | ||||
|             associated with the data types. | ||||
|  | ||||
|             Example: | ||||
|  | ||||
|             ... ado.net/XML headers & schema ... | ||||
|             <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|             <resheader name="version">2.0</resheader> | ||||
|             <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|             <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|             <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|             <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|             <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|                 <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|             </data> | ||||
|             <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|                 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|                 <comment>This is a comment</comment> | ||||
|             </data> | ||||
|  | ||||
|             There are any number of "resheader" rows that contain simple  | ||||
|             name/value pairs. | ||||
|  | ||||
|             Each data row contains a name, and value. The row also contains a  | ||||
|             type or mimetype. Type corresponds to a .NET class that support  | ||||
|             text/value conversion through the TypeConverter architecture.  | ||||
|             Classes that don't support this are serialized and stored with the  | ||||
|             mimetype set. | ||||
|  | ||||
|             The mimetype is used for serialized objects, and tells the  | ||||
|             ResXResourceReader how to depersist the object. This is currently not  | ||||
|             extensible. For a given mimetype the value must be set accordingly: | ||||
|  | ||||
|             Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|             that the ResXResourceWriter will generate, however the reader can  | ||||
|             read any of the formats listed below. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|             value   : The object must be serialized into a byte array  | ||||
|                     : using a System.ComponentModel.TypeConverter | ||||
|                     : and then encoded with base64 encoding. | ||||
|             --> | ||||
|   <xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="Name" xml:space="preserve"> | ||||
|     <value>Name</value> | ||||
|   </data> | ||||
|   <data name="Edit" xml:space="preserve"> | ||||
|     <value>Edit</value> | ||||
|   </data> | ||||
|   <data name="Delete" xml:space="preserve"> | ||||
|     <value>Delete</value> | ||||
|   </data> | ||||
|   <data name="Message.DisplayNone" xml:space="preserve"> | ||||
|     <value>No [Module]s To Display</value> | ||||
|   </data> | ||||
|   <data name="Message.LoadError" xml:space="preserve"> | ||||
|     <value>Error Loading [Module]</value> | ||||
|   </data> | ||||
|   <data name="Message.DeleteError" xml:space="preserve"> | ||||
|     <value>Error Deleting [Module]</value> | ||||
|   </data> | ||||
| </root> | ||||
							
								
								
									
										126
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Settings.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								Oqtane.Server/wwwroot/Modules/Templates/External/Client/Resources/[Owner].[Module]/Settings.resx
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,126 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|             Microsoft ResX Schema  | ||||
|  | ||||
|             Version 2.0 | ||||
|  | ||||
|             The primary goals of this format is to allow a simple XML format  | ||||
|             that is mostly human readable. The generation and parsing of the  | ||||
|             various data types are done through the TypeConverter classes  | ||||
|             associated with the data types. | ||||
|  | ||||
|             Example: | ||||
|  | ||||
|             ... ado.net/XML headers & schema ... | ||||
|             <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|             <resheader name="version">2.0</resheader> | ||||
|             <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|             <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|             <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|             <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|             <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|                 <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|             </data> | ||||
|             <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|                 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|                 <comment>This is a comment</comment> | ||||
|             </data> | ||||
|  | ||||
|             There are any number of "resheader" rows that contain simple  | ||||
|             name/value pairs. | ||||
|  | ||||
|             Each data row contains a name, and value. The row also contains a  | ||||
|             type or mimetype. Type corresponds to a .NET class that support  | ||||
|             text/value conversion through the TypeConverter architecture.  | ||||
|             Classes that don't support this are serialized and stored with the  | ||||
|             mimetype set. | ||||
|  | ||||
|             The mimetype is used for serialized objects, and tells the  | ||||
|             ResXResourceReader how to depersist the object. This is currently not  | ||||
|             extensible. For a given mimetype the value must be set accordingly: | ||||
|  | ||||
|             Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|             that the ResXResourceWriter will generate, however the reader can  | ||||
|             read any of the formats listed below. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|             value   : The object must be serialized with  | ||||
|                     : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|                     : and then encoded with base64 encoding. | ||||
|  | ||||
|             mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|             value   : The object must be serialized into a byte array  | ||||
|                     : using a System.ComponentModel.TypeConverter | ||||
|                     : and then encoded with base64 encoding. | ||||
|             --> | ||||
|   <xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="SettingName.Text" xml:space="preserve"> | ||||
|     <value>Name: </value> | ||||
|   </data> | ||||
|   <data name="SettingName.HelpText" xml:space="preserve"> | ||||
|     <value>Enter a value</value> | ||||
|   </data> | ||||
| </root> | ||||
| @ -7,6 +7,7 @@ using Oqtane.Enums; | ||||
| using Oqtane.Infrastructure; | ||||
| using [Owner].[Module].Repository; | ||||
| using Oqtane.Controllers; | ||||
| using System.Net; | ||||
|  | ||||
| namespace [Owner].[Module].Controllers | ||||
| { | ||||
| @ -25,12 +26,15 @@ namespace [Owner].[Module].Controllers | ||||
|         [Authorize(Policy = PolicyNames.ViewModule)] | ||||
|         public IEnumerable<Models.[Module]> Get(string moduleid) | ||||
|         { | ||||
|             if (int.Parse(moduleid) == _authEntityId[EntityNames.Module]) | ||||
|             int ModuleId; | ||||
|             if (int.TryParse(moduleid, out ModuleId) == _authEntityId[EntityNames.Module]) | ||||
|             { | ||||
|                 return _[Module]Repository.Get[Module]s(int.Parse(moduleid)); | ||||
|                 return _[Module]Repository.Get[Module]s(int.Parse(ModuleId)); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized [Module] Get Attempt {ModuleId}", moduleid); | ||||
|                 HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; | ||||
|                 return null; | ||||
|             } | ||||
|         } | ||||
| @ -43,12 +47,18 @@ namespace [Owner].[Module].Controllers | ||||
|             Models.[Module] [Module] = _[Module]Repository.Get[Module](id); | ||||
|             if ([Module] != null && [Module].ModuleId != _authEntityId[EntityNames.Module]) | ||||
|             { | ||||
|                 [Module] = null; | ||||
|                 return [Module]; | ||||
|             } | ||||
|             else | ||||
|             {  | ||||
|                 _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized [Module] Get Attempt {[Module]Id}", id); | ||||
|                 HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; | ||||
|                 return null; | ||||
|             } | ||||
|             return [Module]; | ||||
|         } | ||||
|  | ||||
|         // POST api/<controller> | ||||
|         [ValidateAntiForgeryToken] | ||||
|         [HttpPost] | ||||
|         [Authorize(Policy = PolicyNames.EditModule)] | ||||
|         public Models.[Module] Post([FromBody] Models.[Module] [Module]) | ||||
| @ -58,23 +68,37 @@ namespace [Owner].[Module].Controllers | ||||
|                 [Module] = _[Module]Repository.Add[Module]([Module]); | ||||
|                 _logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized [Module] Post Attempt {[Module]}", [Module]); | ||||
|                 HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; | ||||
|                 [Module] = null; | ||||
|             } | ||||
|             return [Module]; | ||||
|         } | ||||
|  | ||||
|         // PUT api/<controller>/5 | ||||
|         [ValidateAntiForgeryToken] | ||||
|         [HttpPut("{id}")] | ||||
|         [Authorize(Policy = PolicyNames.EditModule)] | ||||
|         public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module]) | ||||
|         { | ||||
|             if (ModelState.IsValid && [Module].ModuleId == _authEntityId[EntityNames.Module]) | ||||
|             if (ModelState.IsValid && [Module].ModuleId == _authEntityId[EntityNames.Module] && _[Module]Repository.Get[Module]([Module].[Module]Id, false) != null) | ||||
|             { | ||||
|                 [Module] = _[Module]Repository.Update[Module]([Module]); | ||||
|                 _logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized [Module] Put Attempt {[Module]}", [Module]); | ||||
|                 HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; | ||||
|                 [Module] = null; | ||||
|             } | ||||
|             return [Module]; | ||||
|         } | ||||
|  | ||||
|         // DELETE api/<controller>/5 | ||||
|         [ValidateAntiForgeryToken] | ||||
|         [HttpDelete("{id}")] | ||||
|         [Authorize(Policy = PolicyNames.EditModule)] | ||||
|         public void Delete(int id) | ||||
| @ -85,6 +109,11 @@ namespace [Owner].[Module].Controllers | ||||
|                 _[Module]Repository.Delete[Module](id); | ||||
|                 _logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized [Module] Delete Attempt {[Module]Id}", id); | ||||
|                 HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -7,6 +7,7 @@ namespace [Owner].[Module].Repository | ||||
|     { | ||||
|         IEnumerable<Models.[Module]> Get[Module]s(int ModuleId); | ||||
|         Models.[Module] Get[Module](int [Module]Id); | ||||
|         Models.[Module] Get[Module](int [Module]Id, bool tracking); | ||||
|         Models.[Module] Add[Module](Models.[Module] [Module]); | ||||
|         Models.[Module] Update[Module](Models.[Module] [Module]); | ||||
|         void Delete[Module](int [Module]Id); | ||||
|  | ||||
| @ -22,7 +22,19 @@ namespace [Owner].[Module].Repository | ||||
|  | ||||
|         public Models.[Module] Get[Module](int [Module]Id) | ||||
|         { | ||||
|             return _db.[Module].Find([Module]Id); | ||||
|             return Get[Module]([Module]Id, true); | ||||
|         } | ||||
|  | ||||
|         public Models.[Module] Get[Module](int [Module]Id, bool tracking) | ||||
|         { | ||||
|             if (tracking) | ||||
|             { | ||||
|                 return _db.[Module].Find([Module]Id); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 return _db.[Module].AsNoTracking().FirstOrDefault(item => item.[Module]Id == [Module]Id); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public Models.[Module] Add[Module](Models.[Module] [Module]) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker