public bool Process(SorentoLib.Session Session) { // Console.WriteLine(Session.Request.QueryJar.Get ("cmd.path").Value); string path = string.Empty; if (Session.Request.QueryJar.Exist("cmd.path")) { path = Session.Request.QueryJar.Get("cmd.path").Value + "/"; } SorentoLib.Render.Template template = null; // TODO: this responder needs to work correctly. try { template = new SorentoLib.Render.Template (Session, path + Session.Request.QueryJar.Get ("cmd.page").Value); } catch { return false; } template.Render (); template = null; Session.Responder.Request.SendOutputText (Session.Page.Write (Session)); return true; }
public bool Process(SorentoLib.Session Session, string Fullname, string Method) { switch (Fullname.ToLower ()) { #region Form case "sform.form": switch (Method.ToLower ()) { case "send": Form form = Form.Load (new Guid (Session.Request.QueryJar.Get ("cmd.formid").Value)); form.Send (Session); break; } break; #endregion default: throw new Exception (string.Format (sForm.Strings.Exception.FunctionMethodNotFound, Fullname)); } return true; }
public static System.String Write(SorentoLib.Session session, string Content) { // Definitions String result = string.Empty; // if (this._redirect != string.Empty) // { // result += session.Request.HttpRedirect ("UTF-8", this._redirect, SorentoLib.Enums.RedirectType.Location); // } // else // { result += session.Request.HttpHeader("UTF-8"); // result += "\n"; // Write every line in Page. // foreach (System.String line in this._lines) // { // result += line + "\n"; // } result += Content; // } // Finish. return result; }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region sconsole.runtime case "sconsole.runtime": { switch (Method.ToLower ()) { case "getmenuxml": { result.Add ("menuxml", sConsole.Runtime.GetMenuXML (Session).OuterXml); break; } } break; } #endregion } return result; }
public List<SorentoLib.Render.Placeholder> Get(SorentoLib.Session Session) { List<SorentoLib.Render.Placeholder> result = new List<SorentoLib.Render.Placeholder> (); // result.Add (new SorentoLib.Render.Placeholder (SorentoLib.Services.Config.Get<string> (Enums.ConfigKey.google_analyticsplaceholdertag), Google.Analytics.Build ())); return result; }
public void Process(SorentoLib.Session Session) { // True if function returns successfully. bool success = false; // TODO: fix all this. string resulttemplate = string.Empty; // Find Addin to handle resolve. SorentoLib.Tools.ParseTypeName typename = new SorentoLib.Tools.ParseTypeName (Session.Request.QueryJar.Get ("cmd.function").Value); foreach (SorentoLib.Addins.IFunction function in AddinManager.GetExtensionObjects (typeof(SorentoLib.Addins.IFunction))) { if (function.IsProvided (typename.Namspace)) { success = function.Process (Session, typename.Fullname, typename.Method); break; } } // If function returned successfully we need to show the success page, if it has been specified. if (success) { if (Session.Request.QueryJar.Exist ("cmd.onsuccess")) { resulttemplate = Session.Request.QueryJar.Get ("cmd.onsuccess").Value; } } // If function returned unsuccessfull we should show the error page, if it has been specified. else { if (Session.Request.QueryJar.Exist ("cmd.onerror")) { resulttemplate = Session.Request.QueryJar.Get ("cmd.onerror").Value; } } // If redirect has been specfied lets do that. This is good for hiding POST urls. if (Session.Request.QueryJar.Exist ("cmd.redirect")) { if (Session.Request.QueryJar.Get ("cmd.redirect").Value.ToLower () == "true") { Session.Page.Clear (); Session.Page.Redirect = resulttemplate; // Session.Page.Lines.Add(@"<meta HTTP-EQUIV=""REFRESH"" content=""0; url="+ resulttemplate +@""">"); Session.Responder.Request.SendOutputText (Session.Page.Write (Session)); return; } } if (resulttemplate != string.Empty) { SorentoLib.Render.Template template = new SorentoLib.Render.Template (Session, resulttemplate); template.Render (); template = null; } Session.Responder.Request.SendOutputText (Session.Page.Write (Session)); }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region sForm.Form case "sform.form": switch (Method.ToLower ()) { case "new": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (Autoform.Strings.Exception.AjaxSessionPriviliges, "form.new")); result.Add (new Form (request.getValue<string> ("title"))); break; } case "load": { result.Add (Form.Load (request.getValue<Guid> ("id"))); break; } case "save": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (Autoform.Strings.Exception.AjaxSessionPriviliges, "form.save")); request.getValue<Form> ("sform.form").Save (); break; } case "delete": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (Autoform.Strings.Exception.AjaxSessionPriviliges, "form.delete")); Form.Delete (request.getValue<Guid> ("id")); break; } case "send": { Form form = Form.Load (request.getValue<Guid> ("id")); form.Send (Session); break; } case "list": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (Autoform.Strings.Exception.AjaxSessionPriviliges, "form.list")); result.Add (Form.List ()); break; } } break; #endregion8 } return result; }
public void Process(SorentoLib.Session Session) { // TODO: fix all this. string resulttemplate = string.Empty; SorentoLib.Tools.ParseTypeName typename = new SorentoLib.Tools.ParseTypeName (Session.Request.QueryJar.Get ("cmd.function").Value); // Find Addin to handle resolve. foreach (SorentoLib.Addins.IFunction function in AddinManager.GetExtensionObjects (typeof(SorentoLib.Addins.IFunction))) { if (function.IsProvided (typename.Namspace)) { if (function.Process (Session, typename.Fullname, typename.Method)) { if (Session.Request.QueryJar.Exist ("cmd.onsuccess")) { resulttemplate = Session.Request.QueryJar.Get ("cmd.onsuccess").Value; } else { resulttemplate = ""; } } else { if (Session.Request.QueryJar.Exist ("cmd.onerror")) { resulttemplate = Session.Request.QueryJar.Get ("cmd.onerror").Value; } else { resulttemplate = ""; } } break; } } if (Session.Request.QueryJar.Exist ("cmd.redirect")) { if (Session.Request.QueryJar.Get ("cmd.redirect").Value.ToLower () == "true") { Session.Page.Clear (); Session.Page.Redirect = resulttemplate; // Session.Page.Lines.Add(@"<meta HTTP-EQUIV=""REFRESH"" content=""0; url="+ resulttemplate +@""">"); Session.Responder.Request.SendOutputText (Session.Page.Write (Session)); return; } } SorentoLib.Render.Template template = new SorentoLib.Render.Template (Session, resulttemplate); template.Render (); template = null; Session.Responder.Request.SendOutputText (Session.Page.Write (Session)); }
public void Add(SorentoLib.FastCgi.Query Query) { SorentoLib.FastCgi.Query find = this._queries.Find (delegate (SorentoLib.FastCgi.Query temp) { return temp.Name == Query.Name; }); if (find != null) { this._queries.Remove (find); } this._queries.Add (Query); }
public void Add(SorentoLib.FastCgi.Cookie Cookie) { SorentoLib.FastCgi.Cookie result = this._cookies.Find (delegate (SorentoLib.FastCgi.Cookie cookie) { return cookie.Name == Cookie.Name; }); if (result != null) { this._cookies.Remove (result); } this._cookies.Add (Cookie); }
public void Process(SorentoLib.Session session) { SorentoLib.Ajax.Respons respons = null; SorentoLib.Tools.ParseTypeName typename = new SorentoLib.Tools.ParseTypeName (session.Request.QueryJar.Get ("cmd.function").Value); try { // Find ajax addin that can respond to this request. foreach (SorentoLib.Addins.IAjax ajax in AddinManager.GetExtensionObjects (typeof (SorentoLib.Addins.IAjax))) { if (ajax.IsProvided (typename.Namspace)) { respons = ajax.Process (session, typename.Fullname, typename.Method); Hashtable status = new Hashtable (); status.Add ("success", true); respons.Add (status); break; } } // If no addin was found, throw exception. if (respons == null) { throw new Exception (string.Format ("[AJAX]: Namespace '{0}' was not found.", typename.Namspace)); } } catch (Exception exception) { Console.WriteLine (exception); // Handel exceptions, and parse the information onto the client. respons = new SorentoLib.Ajax.Respons (); Hashtable status = new Hashtable (); status.Add ("success", false); status.Add ("exception", exception.Message); respons.Add (status); } // Output ajax respons. session.Responder.Request.SendOutputText (session.Request.HttpHeader ("UTF-8", "text/xml")); session.Responder.Request.SendOutputText ("\n" + respons.XmlDocument.OuterXml); // Cleanup typename = null; respons = null; }
public SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region Google. case "google.": break; #endregion } return result; }
public List<SorentoLib.Render.Placeholder> Get(SorentoLib.Session Session) { List<SorentoLib.Render.Placeholder> result = new List<SorentoLib.Render.Placeholder> (); try { result.Add (new SorentoLib.Render.Placeholder (SorentoLib.Services.Config.Get<string> (Enums.ConfigKey.sconsole_includecssplaceholdertag), Include.GetString ())); // result.Add (new SorentoLib.Render.Placeholder (SorentoLib.Services.Config.Get<string> (Enums.ConfigKey.sconsole_includejsplaceholdertag, Runtime.GetJSInclude ()))); } catch { } return result; }
public override object Process(SorentoLib.Session Session, string Fullname, string Method, object Variable, SorentoLib.Render.Resolver.Parameters Parameters) { switch (Fullname) { #region sCMS.Root case "scms.root": { switch (Method) { case "": { return ((sCMS.Root)Variable); } case "id": { return ((sCMS.Root)Variable).Id; } } break; } #endregion #region sCMS.Page case "scms.page": { switch (Method) { case "": { return ((sCMS.Page)Variable); } case "id": { return ((sCMS.Page)Variable).Id; } case "createtimestamp": { return ((sCMS.Page)Variable).CreateTimestamp; } case "updatetimestamp": { return ((sCMS.Page)Variable).UpdateTimestamp; } case "title": { return ((sCMS.Page)Variable).Title; } case "path": { return ((sCMS.Page)Variable).Path; } case "template": { return ((sCMS.Page)Variable).Template; } case "root": { return ((sCMS.Page)Variable).Root; } case "childpages": { return ((sCMS.Page)Variable).ChildPages; } case "isparent": { return ((sCMS.Page)Variable).IsParent (Parameters.Get<Guid>(0)); } case "getcontent": { switch (Parameters.Type (0).Name.ToLower()) { case "guid": { return ((sCMS.Page)Variable).GetContent (Parameters.Get<Guid>(0)); } case "string": { return ((sCMS.Page)Variable).GetContent (Parameters.Get<string>(0)); } } break; } case "load": { switch (Parameters.Type (0).Name.ToLower()) { case "guid": return sCMS.Page.Load (Parameters.Get<Guid>(0)); case "string": return sCMS.Page.Load (new Guid (Parameters.Get<string>(0))); } break; } case "list": { switch (Parameters.Type (0).Name.ToLower()) { case "guid": { return sCMS.Page.List (Parameters.Get<Guid>(0)); } default: { return sCMS.Page.List (); } } } } break; } #endregion // #region sCMS.Template // case "scms.template": // // switch (Method) // { // case "": // return ((sCMS.Template)Variable); // // case "id": // return ((sCMS.Template)Variable).Id; // // case "createtimestamp": // return ((sCMS.Template)Variable).CreateTimestamp; // // case "updatetimestamp": // return ((sCMS.Template)Variable).UpdateTimestamp; // // case "name": // return ((sCMS.Template)Variable).Title; // // case "fields": // return SorentoLib.Render.Variables.ConvertToListObject<sCMS.Field> (((sCMS.Template)Variable).Fields); // // case "list": //// if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.ResolverSessionPriviliges, "template.list")); // // return SorentoLib.Render.Variables.ConvertToListObject<sCMS.Template> (sCMS.Template.List ()); // } // break; // #endregion #region sCMS.Field case "scms.field": switch (Method) { case "": return ((sCMS.Field)Variable); case "id": return ((sCMS.Field)Variable).Id; case "name": return ((sCMS.Field)Variable).Name; case "type": return ((sCMS.Field)Variable).Type; } break; #endregion #region sCMS.Content case "scms.contentdata": switch (Method) { case "": return ((sCMS.Content)Variable); case "data": return ((sCMS.Content)Variable).Data; } break; #endregion #region sCMS.CollectionSchema case "scms.collectionschema": { switch (Method) { case "": { return ((sCMS.CollectionSchema)Variable); } // case "name": // { // return ((sCMS.CollectionSchema)Variable).Name; // } case "collections": { return ((sCMS.CollectionSchema)Variable).Collections; } case "load": { switch (Parameters.Type (0).Name.ToLower()) { case "guid": return sCMS.CollectionSchema.Load (Parameters.Get<Guid>(0)); case "string": return sCMS.CollectionSchema.Load (new Guid (Parameters.Get<string>(0))); } break; } } break; } #endregion #region sCMS.Collection case "scms.collection": { switch (Method) { case "": { return ((sCMS.Collection)Variable); } case "id": { return ((sCMS.Collection)Variable).Id; } case "title": { return ((sCMS.Collection)Variable).Title; } case "getcontent": { switch (Parameters.Type (0).Name.ToLower()) { case "guid": { return ((sCMS.Collection)Variable).GetContent (Parameters.Get<Guid>(0)); } case "string": { return ((sCMS.Collection)Variable).GetContent (Parameters.Get<string>(0)); } } break; } case "load": switch (Parameters.Type (0).Name.ToLower()) { case "guid": return sCMS.Collection.Load (Parameters.Get<Guid>(0)); case "string": return sCMS.Collection.Load (new Guid (Parameters.Get<string>(0))); } break; } break; } #endregion } throw new SorentoLib.Exceptions.RenderExceptionMemberNotFound (); }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region Allectus.Customer case "allectuslib.customer": { switch (Method.ToLower ()) { case "create": { result.Add (new AllectusLib.Customer ()); break; } case "load": { result.Add (AllectusLib.Customer.Load (request.getValue<Guid>("id"))); break; } case "save": { request.getValue<AllectusLib.Customer> ("allectuslib.customer").Save (); break; } case "destroy": { AllectusLib.Customer.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (AllectusLib.Customer.List ()); break; } } break; } #endregion #region Allectus.Subscription case "allectuslib.subscription": { switch (Method.ToLower ()) { case "create": { result.Add (new AllectusLib.Subscription (Customer.Load (request.getValue<Guid>("customerid")))); break; } case "load": { result.Add (AllectusLib.Subscription.Load (request.getValue<Guid>("id"))); break; } case "save": { request.getValue<AllectusLib.Subscription> ("allectuslib.subscription").Save (); break; } case "destroy": { AllectusLib.Subscription.Delete (request.getValue<Guid> ("id")); break; } case "list": { if (request.ContainsXPath ("customerid")) { result.Add (Subscription.List (request.getValue<Guid> ("customerid"))); } else { result.Add (Subscription.List ()); } break; } } break; } #endregion #region Allectus.SubscriptionItem case "allectuslib.subscriptionitem": { switch (Method.ToLower ()) { case "create": { result.Add (new AllectusLib.SubscriptionItem (Subscription.Load (request.getValue<Guid>("subscriptionid")))); break; } case "load": { result.Add (AllectusLib.SubscriptionItem.Load (request.getValue<Guid>("id"))); break; } case "save": { request.getValue<AllectusLib.SubscriptionItem> ("allectuslib.subscriptionitem").Save (); break; } case "destroy": { AllectusLib.SubscriptionItem.Delete (request.getValue<Guid> ("id")); break; } case "list": { if (request.ContainsXPath ("subscriptionid")) { result.Add (SubscriptionItem.List (request.getValue<Guid> ("subscriptionid"))); } else { result.Add (SubscriptionItem.List ()); } break; } } break; } #endregion #region Allectus.Management.Location case "allectuslib.management.location": { switch (Method.ToLower ()) { case "create": { result.Add (new AllectusLib.Management.Location ()); break; } case "load": { result.Add (AllectusLib.Management.Location.Load (request.getValue<Guid>("id"))); break; } case "save": { request.getValue<AllectusLib.Management.Location> ("allectuslib.management.location").Save (); break; } case "destroy": { AllectusLib.Management.Location.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (AllectusLib.Management.Location.List ()); break; } } break; } #endregion #region Allectus.Product case "allectuslib.product": { switch (Method.ToLower ()) { case "load": { result.Add (C5.Product.Load (request.getValue<string>("id"))); break; } case "list": { result.Add (C5.Product.List ()); break; } } break; } #endregion } return result; }
public bool Process(SorentoLib.Session Session, string Fullname, string Method) { bool result = false; switch (Fullname.ToLower ()) { #region Session case "sorentolib.session": { switch (Method.ToLower ()) { case "login": { // return Session.Login (Session.Request.QueryJar.Get ("username").Value, SorentoLib.Tools.StringHelper.ASCIIBytesToString (SorentoLib.Services.Crypto.Decrypt (SorentoLib.Tools.StringHelper.HexStringToBytes (Session.Request.QueryJar.Get("password").Value)))); result = Session.Login (Session.Request.QueryJar.Get ("username").Value, Session.Request.QueryJar.Get("password").Value); break; } case "logout": { result = Session.Logout (); break; } } break; } #endregion #region Media case "sorentolib.media": { switch (Method.ToLower ()) { case "upload": { try { string path = Session.Request.QueryJar.Get ("path").Value; string filename = System.IO.Path.GetFileNameWithoutExtension (Session.Request.QueryJar.Get ("upload").Value).Replace ("%", "_"); string extension = System.IO.Path.GetExtension (Session.Request.QueryJar.Get ("upload").Value).ToLower (); path = path.Replace ("%%GUID%%", Guid.NewGuid ().ToString ()).Replace ("%%FILENAME%%", filename).Replace ("%%EXTENSION%%", extension); SorentoLib.Enums.MediaStatus status = SNDK.Convert.StringToEnum<SorentoLib.Enums.MediaStatus> (Session.Request.QueryJar.Get ("status").Value); string mediatransformations = Session.Request.QueryJar.Get ("mediatransformations").Value; string mimetypes = Session.Request.QueryJar.Get ("mimetypes").Value; string postuploadscript = Session.Request.QueryJar.Get ("postuploadscript").Value; if (mimetypes.Contains (Session.Request.QueryJar.Get ("upload").BinaryContentType)) { SorentoLib.Media media = new SorentoLib.Media (path, Session.Request.QueryJar.Get ("upload").BinaryData); media.Status = status; media.Save (); if (postuploadscript != string.Empty) { SorentoLib.MediaTransformation.Transform (media.DataPath, SorentoLib.Services.Config.Get<string> (SorentoLib.Enums.ConfigKey.core_pathscript) + postuploadscript); } if (mediatransformations != string.Empty) { foreach (string mediatransformationid in mediatransformations.Split (";".ToCharArray (), StringSplitOptions.RemoveEmptyEntries)) { MediaTransformation mediatransformation = MediaTransformation.Load (new Guid (mediatransformationid)); mediatransformation.Transform (media); } } Session.Page.Variables.Add ("mediaid", media.Id); Session.Page.Variables.Add ("mediasoftpath", media.Path); Console.WriteLine (media.Path); Session.Page.Variables.Add ("uploadsuccess", "true"); } else { Session.Page.Variables.Add ("uploadsuccess", "false"); Session.Page.Variables.Add ("cmderrormessage", Strings.ErrorMessage.MediaUploadMimeType); } result = true; } catch (Exception exception) { Session.Page.Variables.Add ("uploadsuccess", "false"); Session.Page.Variables.Add ("cmderrormessage", Strings.ErrorMessage.MediaUploadUnknown); SorentoLib.Services.Logging.LogDebug (string.Format (Strings.LogDebug.MediaUploadException, exception.ToString ())); } } break; } break; } #endregion // TODO: Implement Function[SorentoLib.User] #region User case "sorentolib.user": break; #endregion // TODO: Implement Function[SorentoLib.UserGroup] #region UserGroup case "sorentolib.usergroup": break; #endregion #region SorentoLib.Services.Snapshot case "sorentolib.services.snapshot": { switch (Method.ToLower ()) { case "upload": { if (Session.Request.QueryJar.Get ("upload").BinaryContentType == "application/zip") { FileStream filestream = File.Create (SorentoLib.Services.Config.Get<string> (SorentoLib.Enums.ConfigKey.snapshot_path) + Session.Request.QueryJar.Get ("upload").Value); BinaryWriter binarywriter = new BinaryWriter(filestream); binarywriter.Write(Session.Request.QueryJar.Get ("upload").BinaryData); binarywriter.Close(); filestream.Close(); Session.Page.Variables.Add ("uploadsuccess", "true"); } break; } } break; } #endregion } return result; }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region SorentoLib.User case "sorentolib.user": { switch (Method.ToLower ()) { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Administrator) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "template.new")); case "new": { result.Add (new SorentoLib.User (request.getValue<string> ("username"), request.getValue<string> ("email"))); break; } case "load": { result.Add (SorentoLib.User.Load (request.getValue<Guid> ("id"))); break; } case "save": { request.getValue<SorentoLib.User> ("sorentolib.user").Save (); break; } case "delete": { SorentoLib.User.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (SorentoLib.User.List ()); break; } case "changepassword": { if (request.getValue<Guid> ("userid") == Session.User.Id) { if (request.xPathExists ("oldpassword")) { string oldpassword = request.getValue<string> ("oldpassword"); string newpassword = request.getValue<string> ("newpassword"); if (Session.User.Authenticate (oldpassword)) { Session.User.Password = newpassword; Session.User.Save (); } } } else { string newpassword = request.getValue<string> ("newpassword"); SorentoLib.User user = SorentoLib.User.Load (request.getValue<Guid> ("userid")); user.Password = newpassword; user.Save (); } // string oldpassword = SorentoLib.Tools.StringHelper.ASCIIBytesToString (SorentoLib.Services.Crypto.Decrypt (SorentoLib.Tools.StringHelper.HexStringToBytes (request.Key<string> ("oldpassword")))); // string newpassword = SorentoLib.Tools.StringHelper.ASCIIBytesToString (SorentoLib.Services.Crypto.Decrypt (SorentoLib.Tools.StringHelper.HexStringToBytes (request.Key<string> ("newpassword")))); // SorentoLib.User user = new SorentoLib.User (); // if (user.Load (new Guid (request.Data<string> ("id")))) // { // if (user.Authenticate (oldpassword)) // { // user.Password = newpassword; // // if (user.Save ()) // { // result.Data.Add ("success", "true"); // } // } // } break; } case "isusernameinuse": { if (request.xPathExists ("id")) { result.Add ("result", SorentoLib.User.IsUsernameInUse (request.getValue<string> ("username"), new Guid (request.Key<string>("id")))); // result.Add ("result", SorentoLib.User.IsUsernameInUse (request.Key<string>("username"), new Guid (request.Key<string>("id")))); } else { result.Add ("result", SorentoLib.User.IsUsernameInUse (request.getValue<string> ("username"))); // result.Add ("result", SorentoLib.User.IsUsernameInUse (request.Key<string>("username"))); } break; } case "isemailinuse": { if (request.xPathExists ("id")) { result.Add ("result", SorentoLib.User.IsEmailInUse (request.getValue<string>("email"), new Guid (request.getValue<string>("id")))); } else { result.Add ("result", SorentoLib.User.IsEmailInUse (request.getValue<string>("email"))); } break; } default: break; } break; } #endregion #region SorentoLib.Usergroup case "sorentolib.usergroup": { switch (Method.ToLower ()) { case "new": { result.Add (new SorentoLib.Usergroup ()); break; } case "load": { result.Add (SorentoLib.Usergroup.Load (request.getValue<Guid> ("id"))); break; } case "save": { request.getValue<SorentoLib.Usergroup> ("sorentolib.usergroup").Save (); break; } case "delete": { SorentoLib.Usergroup.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (SorentoLib.Usergroup.List ()); break; } case "accesslevels": { List<SorentoLib.Enums.Accesslevel> test1 = new List<SorentoLib.Enums.Accesslevel> (); foreach (SorentoLib.Enums.Accesslevel accesslevel in Enum.GetValues(typeof(SorentoLib.Enums.Accesslevel))) { // Hashtable test2 = new Hashtable (); // test2.Add ("name", accesslevel.ToString ()); // test2.Add ("value", (int)accesslevel); test1.Add (accesslevel); } result.Add (test1); break; } } break; } #endregion #region SorentoLib.Session case "sorentolib.session": { switch (Method.ToLower ()) { case "getcurrent": { // result.Data = Session.ToItem (); break; } case "logout": { result.Add (Session.Logout ()); break; } } break; } #endregion #region SorentoLib.Media case "sorentolib.media": { switch (Method.ToLower ()) { case "load": { SorentoLib.Media media = SorentoLib.Media.Load (new Guid (request.Key<string> ("id"))); // result.Data.Add ("id", media.Id); // result.Data.Add ("createtimestamp", media.CreateTimestamp); // result.Data.Add ("updatetimestamp", media.UpdateTimestamp); // result.Data.Add ("path", media.Path); // result.Data.Add ("directoryname", media.DirectoryName); // result.Data.Add ("filename", media.FileName); // result.Data.Add ("mimetype", media.Mimetype); // result.Data.Add ("size", media.Size); // result.Data.Add ("accesslevel", media.Accesslevel); // result.Data.Add ("status", media.Status); break; } } break; } #endregion #region SorentoLib.Transformation case "sorentolib.mediatransformation": { switch (Method.ToLower ()) { case "new": { MediaTransformation mediatransformation = MediaTransformation.FromAjaxRequest (request); mediatransformation.Save (); mediatransformation.ToAjaxRespons (result); break; } case "load": { MediaTransformation mediatransformation = MediaTransformation.Load (new Guid (request.Key<string> ("id"))); mediatransformation.ToAjaxRespons (result); break; } case "save": { MediaTransformation mediatransformation = MediaTransformation.FromAjaxRequest (request); mediatransformation.Save (); break; } case "delete": { MediaTransformation.Delete (new Guid (request.Key<string> ("id"))); break; } case "list": { List<Hashtable> mediatransformations = new List<Hashtable> (); foreach (SorentoLib.MediaTransformation mediatransformation in SorentoLib.MediaTransformation.List ()) { mediatransformations.Add (mediatransformation.ToAjaxItem ()); } // result.Data.Add ("mediatransformations", mediatransformations); break; } default: break; } break; } #endregion #region SorentoLib.Services.Config case "sorentolib.services.config": { switch (Method.ToLower ()) { case "get": { if (request.Data.ContainsKey ("keys")) { Hashtable data = new Hashtable (); foreach (string key in ((Hashtable)request.Data["keys"]).Keys) { data.Add (((Hashtable)request.Data["keys"])[key], SorentoLib.Services.Config.Get<string> (((Hashtable)request.Data["keys"])[key])); } // result.Data.Add ("data", data); } else { // result.Data.Add ("value", SorentoLib.Services.Config.Get<string> (request.Key<string> ("module"), request.Key<string> ("key"))); } break; } case "set": { if (request.Data.ContainsKey ("keys")) { foreach (string key in ((Hashtable)request.Data["keys"]).Keys) { SorentoLib.Services.Config.Set (key, ((Hashtable)request.Data["keys"])[key]); } } else { SorentoLib.Services.Config.Set (request.Key<string> ("module"), request.Key<string> ("key"), request.Key<string> ("value")); } break; } } break; } #endregion #region SorentoLib.Serivces.Snapshot case "sorentolib.services.snapshot": { switch (Method.ToLower ()) { case "new": { SorentoLib.Services.Snapshot.Take (); break; } case "load": { SorentoLib.Services.Snapshot snapshot = SorentoLib.Services.Snapshot.Load (request.Key<string> ("id")); snapshot.ToAjaxRespons (result); break; } case "develop": { SorentoLib.Services.Snapshot.Develop (SorentoLib.Services.Snapshot.Load (request.Key<string> ("id"))); break; } case "delete": { SorentoLib.Services.Snapshot.Delete (request.Key<string> ("id")); break; } case "list": { List<Hashtable> snapshots = new List<Hashtable> (); foreach (SorentoLib.Services.Snapshot snapshot in SorentoLib.Services.Snapshot.List ()) { snapshots.Add (snapshot.ToAjaxItem ()); } // result.Data.Add ("snapshots", snapshots); break; } default: break; } break; } #endregion } return result; }
internal static void UserUpdated(SorentoLib.User User) { if (SorentoLib.Services.Events.UserUpdated != null) { List<object> sender = new List<object>(); sender.Add (User); SorentoLib.Services.Events.UserUpdated (sender, new EventArgs ()); } }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region sCMS.Template case "scms.template": switch (Method.ToLower ()) { case "new": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "template.new")); result.Add (new Template ()); break; } case "load": { result.Add (Template.Load (request.getValue<Guid>("id"))); break; } case "save": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "template.save")); request.getValue<Template> ("scms.template").Save (); break; } case "delete": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "template.delete")); Template.Delete (request.getValue<Guid> ("id")); break; } case "list": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "template.list")); result.Add (Template.List ()); break; } } break; #endregion #region sCMS.Root case "scms.root": switch (Method.ToLower ()) { case "new": { result.Add (new Root (request.getValue<string> ("title"))); break; } case "load": { result.Add (Root.Load (request.getValue<Guid> ("id"))); break; } case "save": { request.getValue<sCMS.Root> ("scms.root").Save (); break; } case "delete": { Root.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (Root.List ()); break; } } break; #endregion #region sCMS.Page case "scms.page": { switch (Method.ToLower ()) { case "new": { result.Add (new Page (request.getValue<Guid> ("rootid"), request.getValue<Guid> ("templateid"), request.getValue<Guid> ("parentid"), request.getValue<string> ("title"))); break; } case "load": { result.Add (Page.Load (request.getValue<Guid> ("id"))); break; } case "save": { request.getValue<Page> ("scms.page").Save (); break; } case "delete": { Page.Delete (request.getValue<Guid> ("id")); break; } case "list": { result.Add (Page.List ()); break; } } break; } #endregion #region sCMS.Collection case "scms.collection": switch (Method.ToLower ()) { case "new": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collection.new")); result.Add (new Collection (CollectionSchema.Load (request.getValue<Guid> ("collectionschemaid")), request.getValue<string> ("title"))); break; } case "load": { result.Add (Collection.Load (request.getValue<Guid> ("id"))); break; } case "save": { request.getValue<Collection> ("scms.collection").Save (); break; } case "delete": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collection.delete")); Collection.Delete (request.getValue<Guid> ("id")); break; } case "list": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collection.list")); result.Add (Collection.List ()); break; } } break; #endregion #region sCMS.CollectionSchema case "scms.collectionschema": switch (Method.ToLower ()) { case "new": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collectionschema.new")); result.Add (new CollectionSchema (request.getValue<string>("title"))); break; } case "load": { result.Add (CollectionSchema.Load (request.getValue<Guid> ("id"))); break; } case "save": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collectionschema.save")); request.getValue<CollectionSchema> ("scms.collectionschema").Save (); break; } case "delete": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collectionschema.delete")); CollectionSchema.Delete (request.getValue<Guid> ("id")); break; } case "list": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "collectionschema.list")); result.Add (CollectionSchema.List ()); break; } } break; #endregion #region sCMS.Stylesheet case "scms.stylesheet": switch (Method.ToLower ()) { case "new": { result.Add (new Stylesheet (request.getValue<string> ("title"))); break; } case "load": { result.Add (Stylesheet.Load (request.getValue<string> ("id"))); break; } case "save": { request.getValue<Stylesheet> ("scms.stylesheet").Save (); break; } case "delete": { Stylesheet.Delete (request.getValue<string> ("id")); break; } case "list": { result.Add (Stylesheet.List ()); break; } } break; #endregion #region sCMS.Javascript case "scms.javascript": switch (Method.ToLower ()) { case "new": { result.Add (new Javascript (request.getValue<string> ("title"))); break; } case "load": { result.Add (Javascript.Load (request.getValue<string> ("id"))); break; } case "save": { request.getValue<Javascript> ("scms.javascript").Save (); break; } case "delete": { Javascript.Delete (request.getValue<string> ("id")); break; } case "list": { result.Add (Javascript.List ()); break; } } break; #endregion #region sCMS.Global case "scms.global": switch (Method.ToLower ()) { case "new": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "global.new")); result.Add (new Global (SNDK.Convert.StringToEnum<Enums.FieldType> (request.getValue<string> ("type")), request.getValue<string> ("name"))); // Console.WriteLine (request.getValue<string> ("type")); // Console.WriteLine (request.getValue<string> ("name")); // Console.WriteLine ("test"); break; } case "load": { result.Add (Global.Load (request.getValue<Guid> ("id"))); break; } case "save": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "global.save")); request.getValue<Global> ("scms.global").Save (); break; } case "delete": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Editor) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "global.delete")); Global.Delete (request.getValue<Guid> ("id")); break; } case "list": { // if (Session.AccessLevel < SorentoLib.Enums.Accesslevel.Author) throw new Exception (string.Format (sCMS.Strings.Exception.AjaxSessionPriviliges, "stylesheet.list")); result.Add (Global.List ()); break; } } break; #endregion } return result; }
public override object Process(SorentoLib.Session Session, string Fullname, string Method, object Variable, SorentoLib.Render.Resolver.Parameters Parameters) { switch (Fullname) { #region SorentoLib.Session case "sorentolib.session": switch (Method) { case "": return ((SorentoLib.Session)Variable); case "id": return ((SorentoLib.Session)Variable).Id; case "createtimestamp": return ((SorentoLib.Session)Variable).CreateTimestamp; case "updatetimestamp": return ((SorentoLib.Session)Variable).UpdateTimestamp; case "languages": return SorentoLib.Render.Variables.ConvertToListObject<string> (((SorentoLib.Session)Variable).Languages); case "user": return ((SorentoLib.Session)Variable).User; case "cookiejar": return ((SorentoLib.Session)Variable).Request.CookieJar; case "queryjar": return ((SorentoLib.Session)Variable).Request.QueryJar; case "remoteaddress": return ((SorentoLib.Session)Variable).RemoteAddress; // case "accesslevel": // return ((SorentoLib.Session)Variable).AccessLevel; case "loggedin": return ((SorentoLib.Session)Variable).LoggedIn; // case "authenticatebyaccesslevel": // return ((SorentoLib.Session)Variable).AuthenticateByAccesslevel (SNDK.Convert.StringToEnum<SorentoLib.Enums.Accesslevel>(Parameters.Get<string>(0))); case "authenticate": switch (Parameters.Type (0).Name.ToLower()) { case "guid": return ((SorentoLib.Session)Variable).Authenticate (Parameters.Get<Guid>(0)); case "string": return ((SorentoLib.Session)Variable).Authenticate (Parameters.Get<string>(0)); default: return null; } case "current": return Session; case "error": return Session.Error; } break; #endregion #region SorentoLib.Error case "sorentolib.error": switch (Method) { case "": return ((SorentoLib.Error)Variable); case "id": return ((SorentoLib.Error)Variable).Id; case "title": return ((SorentoLib.Error)Variable).Title; case "text": return ((SorentoLib.Error)Variable).Text; } break; #endregion #region SorentoLib.FastCgi.CookieJar case "sorentolib.fastcgi.cookiejar": switch (Method) { case "": return ((SorentoLib.FastCgi.CookieJar)Variable); case "get": return ((SorentoLib.FastCgi.CookieJar)Variable).Get (Parameters.Get<string> (0)); case "exist": return ((SorentoLib.FastCgi.CookieJar)Variable).Exist (Parameters.Get<string> (0)); } break; #endregion #region SorentoLib.FastCgi.Cookie case "sorentolib.fastcgi.cookie": switch (Method) { case "": return ((SorentoLib.FastCgi.Cookie)Variable); case "name": return ((SorentoLib.FastCgi.Cookie)Variable).Name; case "domain": return ((SorentoLib.FastCgi.Cookie)Variable).Domain; case "path": return ((SorentoLib.FastCgi.Cookie)Variable).Path; case "expires": return ((SorentoLib.FastCgi.Cookie)Variable).Expires; case "value": return ((SorentoLib.FastCgi.Cookie)Variable).Value; case "secure": return ((SorentoLib.FastCgi.Cookie)Variable).Secure; } break; #endregion #region SorentoLib.FastCgi.QueryJar case "sorentolib.fastcgi.queryjar": switch (Method) { case "": return ((SorentoLib.FastCgi.QueryJar)Variable); case "get": return ((SorentoLib.FastCgi.QueryJar)Variable).Get (Parameters.Get<string>(0)); case "exist": return ((SorentoLib.FastCgi.QueryJar)Variable).Exist (Parameters.Get<string>(0)); } break; #endregion #region SorentoLib.FastCgi.Query case "sorentolib.fastcgi.query": switch (Method) { case "": return ((SorentoLib.FastCgi.Query)Variable); case "name": return ((SorentoLib.FastCgi.Query)Variable).Name; case "value": return ((SorentoLib.FastCgi.Query)Variable).Value; } break; #endregion #region SorentoLib.User case "sorentolib.user": switch (Method) { case "": return ((SorentoLib.User)Variable); case "id": return ((SorentoLib.User)Variable).Id; case "createtimestamp": return ((SorentoLib.User)Variable).CreateTimestamp; case "updatetimestamp": return ((SorentoLib.User)Variable).UpdateTimestamp; case "username": return ((SorentoLib.User)Variable).Username; case "email": return ((SorentoLib.User)Variable).Email; case "realname": return ((SorentoLib.User)Variable).Realname; case "firstname": return ((SorentoLib.User)Variable).FirstName; case "lastname": return ((SorentoLib.User)Variable).LastName; // case "accesslevel": // return ((SorentoLib.User)Variable).Accesslevel; case "usergroups": return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.Usergroup> (((SorentoLib.User)Variable).Usergroups); case "status": return ((SorentoLib.User)Variable).Status; case "load": switch (Parameters.Type (0).Name.ToLower()) { case "guid": return SorentoLib.User.Load (Parameters.Get<Guid>(0)); case "string": return SorentoLib.User.Load (Parameters.Get<string>(0)); default: return null; } break; case "list": switch (Parameters.Count) { case 1: // return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.User> (SorentoLib.User.List(SorentoLib.Enums.UserListFilter.OnlyUsersThatIsMemberOfUsergroupId, Parameters.Get<Guid>(0))); break; default: return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.User> (SorentoLib.User.List()); } break; } break; #endregion #region SorentoLib.Usergroup case "sorentolib.usergroup": switch (Method) { case "": return ((SorentoLib.Usergroup)Variable); case "id": return ((SorentoLib.Usergroup)Variable).Id; case "createtimestamp": return ((SorentoLib.Usergroup)Variable).CreateTimestamp; case "updatetimestamp": return ((SorentoLib.Usergroup)Variable).UpdateTimestamp; case "name": return ((SorentoLib.Usergroup)Variable).Name; // case "accesslevel": // return ((SorentoLib.Usergroup)Variable).Accesslevel; case "status": return ((SorentoLib.Usergroup)Variable).Status; case "load": return Usergroup.Load (Parameters.Get<Guid>(0)); case "list": switch (Parameters.Count) { // case 2: // return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.Usergroup> (SorentoLib.Usergroup.List(SorentoLib.Enums.UsergroupListFilter.ExcludeUsergroupsThatUsernameIsMemberOf, (string)Parameters[1])); // return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.Usergroup> (SorentoLib.Usergroup.List(SorentoLib.Enums.UsergroupListFilter.ExcludeUsergroupsThatUsernameIsMemberOf, (string)Parameters[1])); default: return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.Usergroup> (SorentoLib.Usergroup.List()); } } break; #endregion #region SorentoLib.Media case "sorentolib.media": switch (Method) { case "": return ((SorentoLib.Media)Variable); case "id": return ((SorentoLib.Media)Variable).Id; case "createtimestamp": return ((SorentoLib.Media)Variable).CreateTimestamp; case "updatetimestamp": return ((SorentoLib.Media)Variable).UpdateTimestamp; case "path": return ((SorentoLib.Media)Variable).Path; case "filename": // return ((SorentoLib.Media)Variable).FileName; case "directoryname": // return ((SorentoLib.Media)Variable).DirectoryName; case "mimetype": return ((SorentoLib.Media)Variable).Mimetype; case "size": return ((SorentoLib.Media)Variable).Size; case "status": // return ((SorentoLib.Media)Variable).Status; case "accesslevel": // return ((SorentoLib.Media)Variable).Accesslevel; case "usergroups": // return SorentoLib.Render.Variables.ConvertToListObject<SorentoLib.Usergroup> (((SorentoLib.Media)Variable).Usergroups); case "load": return SorentoLib.Media.Load (Parameters.Get<Guid>(0)); } break; #endregion #region SorentoLib.Services.Config case "sorentolib.services.config": switch (Method) { case "getstring": return SorentoLib.Services.Config.Get<string> (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); // case "getbool": return SorentoLib.Services.Config.Get<bool> (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); // case "getint": return SorentoLib.Services.Config.Get<int> (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); // case "getdecimal": return SorentoLib.Services.Config.Get<decimal> (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); // case "getguid": return SorentoLib.Services.Config.Get<Guid> (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); // // case "exist": // return SorentoLib.Services.Config.Exist (Parameters.Get<string> (0) +"_"+ Parameters.Get<string> (1)); } break; #endregion #region SorentoLib.Services.Stats case "sorentolib.services.stats": switch (Method) { case "getstring": return SorentoLib.Services.Stats.Get<string> (Parameters.Get<string> (0)); case "getint": return SorentoLib.Services.Stats.Get<int> (Parameters.Get<string> (0)); case "getdecimal": return SorentoLib.Services.Stats.Get<decimal> (Parameters.Get<string> (0)); case "exist": return SorentoLib.Services.Stats.Exist (Parameters.Get<string> (0)); } break; #endregion #region SorentoLib.Services.Crypto case "sorentolib.services.crypto": switch (Method) { case "encryptexponent": return SorentoLib.Services.Crypto.EncryptExponent; case "modulus": return SorentoLib.Services.Crypto.Modulus; } break; #endregion #region SorentoLib.Env case "sorentolib.env": switch (Method) { case "authtype": return Session.Request.Environment.AuthType; case "contentlength": return Session.Request.Environment.ContentLength; case "contenttype": return Session.Request.Environment.ContentType; case "contenttypemultipartboundary": return Session.Request.Environment.ContentTypeMultipartBoundary; case "documentroot": return Session.Request.Environment.DocumentRoot; case "gatewayinterface": return Session.Request.Environment.GatewayInterface; case "httpaccept": return Session.Request.Environment.HttpAccept; case "httpacceptcharset": return Session.Request.Environment.HttpAcceptCharset; case "httpacceptencoding": return Session.Request.Environment.HttpAcceptEncoding; case "httpacceptlanguage": return Session.Request.Environment.HttpAcceptLanguage; case "httpconnection": return Session.Request.Environment.HttpConnection; case "httpcookie": return Session.Request.Environment.HttpCookie; case "httphost": return Session.Request.Environment.HttpHost; case "httpkeepalive": return Session.Request.Environment.HttpKeepAlive; case "httpreferer": return Session.Request.Environment.HttpReferer; case "httpuseragent": return Session.Request.Environment.HttpUserAgent; case "pathinfo": return Session.Request.Environment.PathInfo; case "pathtranslated": return Session.Request.Environment.PathTranslated; case "querystring": return Session.Request.Environment.QueryString; case "redirectquerystring": return Session.Request.Environment.RedirectQueryString; case "redirectstatus": return Session.Request.Environment.RedirectStatus; case "redirecturl": return Session.Request.Environment.RedirectUrl; case "remoteaddress": return Session.Request.Environment.RemoteAddress; case "remotehost": return Session.Request.Environment.RemoteHost; case "remoteident": return Session.Request.Environment.RemoteIdent; case "remoteuser": return Session.Request.Environment.RemoteUser; case "requestmethod": return Session.Request.Environment.RequestMethod; case "requesturi": return Session.Request.Environment.RequestUri; case "serveraddress": return Session.Request.Environment.ServerAddress; case "serveradmin": return Session.Request.Environment.ServerAdmin; case "servername": return Session.Request.Environment.ServerName; case "serverport": return Session.Request.Environment.ServerPort; case "serverprotocol": return Session.Request.Environment.ServerProtocol; case "serversignature": return Session.Request.Environment.ServerSignature; case "serversoftware": return Session.Request.Environment.ServerSoftware; case "version": return SorentoLib.Runtime.GetVersionString (); case "compiledate": return SorentoLib.Runtime.GetCompileDate (); } break; #endregion #region System.Guid case "system.guid": switch (Method) { case "": return ((Guid)Variable); case "tostring": return ((Guid)Variable).ToString(); case "new": switch (Parameters.Count) { case 1: return new Guid (Parameters.Get<string> (0)); default: return Guid.NewGuid(); } } break; #endregion #region System.String case "system.string": switch (Method) { case "": return ((string)Variable); case "length": return ((string)Variable); case "padleft": return ((string)Variable).PadLeft (Parameters.Get<int> (0), Parameters.Get<string> (1)[0]); case "padright": return ((string)Variable).PadRight (Parameters.Get<int> (0), Parameters.Get<string> (1)[0]); case "substring": return ((string)Variable).Substring (Parameters.Get<int> (0), Parameters.Get<int> (1)); case "removenewline": return ((string)Variable).Replace (System.Environment.NewLine, string.Empty); case "replace": //SorentoLib.Services.Logging.LogDebug ("Char:"+Parameters.Get<string> (0)); return ((string)Variable).Replace (Parameters.Get<string> (0), Parameters.Get<string> (1)); //string test = "\n"; //return ((string)Variable).Replace (test, Parameters.Get<string> (1)); //return ((string)Variable).Replace (System.Environment.NewLine, Parameters.Get<string> (1)); case "split": return ((string)Variable).Split (Parameters.Get<string> (0).ToCharArray (), StringSplitOptions.RemoveEmptyEntries); case "tolower": return ((string)Variable).ToLower (); case "toupper": return ((string)Variable).ToUpper (); case "nolinebreak": return ((string)Variable).Replace ("\n","").Replace ("\r",""); case "truncate": switch (Parameters.Count) { case 2: if (Parameters.Get<int> (0) < ((string)Variable).Length) { return ((string)Variable).Substring (0, Parameters.Get<int> (0)) + Parameters.Get<string> (1); } else { return (string)Variable; } default: if (Parameters.Get<int> (0) < ((string)Variable).Length) { return ((string)Variable).Substring (0, Parameters.Get<int> (0)); } else { return (string)Variable; } } } break; #endregion #region System.String[] case "system.string[]": switch (Method) { case "": if (Parameters.Count > 0) { return ((string[])Variable)[Parameters.Get<int> (0)]; } else { return ((string[])Variable); } case "length": return ((string[])Variable).Length; } break; #endregion #region System.Int case "system.int32": switch (Method) { case "": return ((int)Variable); case "tostring": return ((int)Variable).ToString (); } break; #endregion #region System.Boolean case "system.boolean": switch (Method) { case "": { return ((bool)Variable); } } break; #endregion #region System.Datetime case "system.datetime": switch (Method) { case "": return ((DateTime)Variable); case "day": return ((DateTime)Variable).Day; case "month": return ((DateTime)Variable).Month; case "year": return ((DateTime)Variable).Year; case "hour": return ((DateTime)Variable).Hour; case "minute": return ((DateTime)Variable).Minute; case "second": return ((DateTime)Variable).Second; case "millisecond": return ((DateTime)Variable).Millisecond; case "dayofweek": return ((DateTime)Variable).DayOfWeek; case "dayofyear": return ((DateTime)Variable).DayOfYear; case "now": return DateTime.Now; case "fromtimestamp": return SNDK.Date.TimestampToDateTime (Parameters.Get<int> (0)); } break; #endregion #region System.Collections.Generic case "system.collections.generic.list`1": switch (Method) { case "": return (object)Variable; case "count": MethodInfo methodInfo = typeof(SorentoLib.Render.Variables).GetMethod("ConvertToListObjectNew", System.Reflection.BindingFlags.Static | BindingFlags.Public); MethodInfo genericMethodInfo = methodInfo.MakeGenericMethod(new Type[] { ((object)Variable).GetType ().GetGenericArguments()[0] }); List<object> returnvalue = (List<object>)genericMethodInfo.Invoke(null, new object[] { (object)Variable }); return returnvalue.Count; } break; #endregion #region System.Collections.Hashtable case "system.collections.hashtable": // Console.WriteLine ("11"); switch (Method) { case "": return ((Hashtable)Variable); case "get": return ((Hashtable)Variable)[Parameters.Get<string> (0)]; case "keys": List<string> result = new List<string> (); foreach (string key in ((Hashtable)Variable).Keys) { result.Add (key); } return SorentoLib.Render.Variables.ConvertToListObject<string> (result); } break; #endregion #region System.Version case "system.version": { switch (Method) { case "": return ((Version)Variable); case "major": return ((Version)Variable).Major; case "minor": return ((Version)Variable).Minor; case "Build": return ((Version)Variable).Build; case "Revision": return ((Version)Variable).Revision; case "MajorRevision": return ((Version)Variable).MajorRevision; case "MinorRevision": return ((Version)Variable).MinorRevision; } break; } #endregion } throw new SorentoLib.Exceptions.RenderExceptionMemberNotFound (); }
public virtual SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { return null; }
public static void VerificationEmail(SorentoLib.User User) { // SorentoLib.Tools.Helpers.SendMail ("*****@*****.**", User.Email, "Bla bla bla bla"); }
public void ToAjaxRespons(SorentoLib.Ajax.Respons Respons) { // Respons.Data = this.ToAjaxItem (); }
public string HttpRedirect(string charset, string url, SorentoLib.Enums.RedirectType Type) { string result = string.Empty; result = this._cookiejar.Bake (); switch (Type) { case SorentoLib.Enums.RedirectType.HTTP301: result += "Status: HTTP/1.1 301 Moved Permanently\n\n"; result += "Location: http://www.example.org/\n\n"; break; case SorentoLib.Enums.RedirectType.Location: result += "Location: "+ url +"\n\n"; break; } result += "Content-type: text/html; charset="+ charset +"\n\n"; return result; }
internal static void UserStatusChanged(SorentoLib.User User, SorentoLib.Enums.UserStatus From, SorentoLib.Enums.UserStatus To) { if (SorentoLib.Services.Events.UserStatusChanged != null) { List<object> sender = new List<object>(); sender.Add (User); sender.Add (From); sender.Add (To); SorentoLib.Services.Events.UserStatusChanged (sender, new EventArgs ()); } }
public virtual object Process(SorentoLib.Session Session, object Variable, string Method, SorentoLib.Render.Resolver.Parameters Parameters) { return Process (Session, Variable.GetType ().Namespace.ToLower ()+"."+Variable.GetType ().Name.ToLower (), Method.ToLower (), Variable, Parameters); }
internal static void SessionLoginFailed(SorentoLib.Session Session) { if (SorentoLib.Services.Events.SessionLoginFailed != null) { List<object> sender = new List<object>(); sender.Add (Session); SorentoLib.Services.Events.SessionLoginFailed (sender, new EventArgs ()); } }
public virtual object Process(SorentoLib.Session Session, string Fullname, string Method, SorentoLib.Render.Resolver.Parameters Parameters) { return Process (Session, Fullname.ToLower (), Method.ToLower (), null, Parameters); }
public new SorentoLib.Ajax.Respons Process(SorentoLib.Session Session, string Fullname, string Method) { SorentoLib.Ajax.Respons result = new SorentoLib.Ajax.Respons (); SorentoLib.Ajax.Request request = new SorentoLib.Ajax.Request (Session.Request.QueryJar.Get ("data").Value); switch (Fullname.ToLower ()) { #region sXUL.EventListener case "sxul.eventlistener": { switch (Method.ToLower ()) { case "attach": { result.Add (EventListener.Attach ()); break; } case "detach": { EventListener.Detach (request.getValue<Guid> ("eventlistenerid")); break; } case "update": { if (request.ContainsXPath ("eventid")) { // Console.WriteLine (request.XmlDocument.InnerXml); Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (request.GetXml ("eventdata") .SelectSingleNode ("(//eventdata)[1]"))); // try // { // item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//didius.customer)[1]"))); // } // catch // { // item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument); // } // XmlDocument test1 = request.GetXml ("eventdata"); // Console.WriteLine (test1.InnerXml); // Hashtable test2 = (Hashtable)SNDK.Convert.FromXmlDocument (test1); // string test2 = test1.InnerXml; // Console.WriteLine (test2); // object test = request.getValue<object> ("eventdata"); EventListener.Update (request.getValue<Guid> ("eventlistenerid"), request.getValue<string> ("eventid"), item); } else { result.Add (EventListener.Update (request.getValue<Guid> ("eventlistenerid"))); } break; } } break; } #endregion // #region sXUL.Confog // case "sxul.config": // { // switch (Method.ToLower ()) // { // case "set": // { // Config.Set (request.getValue<string> ("key"), request.getValue<string> ("value")); // break; // } // // case "get": // { // result.Add (Config.Get (request.getValue<string> ("key"))); // break; // } // } // break; // } // #endregion } return result; }
public virtual object Process(SorentoLib.Session Session, string Fullname, string Method, object Variable, SorentoLib.Render.Resolver.Parameters Parameters) { return null; }