+ // this small example will add two web site modules, thus handling
+ // two different sites. In reality you should add Controller modules or something
+ // two the website modules to be able to handle different requests.
+ HttpServer server = new HttpServer();
+ server.Add(new WebSiteModule("www.gauffin.com", "Gauffin Telecom AB"));
+ server.Add(new WebSiteModule("www.vapadi.se", "Remote PBX"));
+
+ // start regular http
+ server.Start(IPAddress.Any, 80);
+
+ // start https
+ server.Start(IPAddress.Any, 443, myCertificate);
+
+
+ JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);");
+
+
+ JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);");
+
+
+ JSHelper.AjaxUpdater("/user/show/1", "userInfo", "onsuccess:", "alert('Successful!');");
+
+
+ // plain text
+ JSHelper.AjaxRequest("'/user/show/1'");
+
+ // ajax request using this.href
+ string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>";
+
+
+ JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true");
+
+
+ Event.observe(window, 'load',
+ function() {
+ document.getElementsByClassName('modal').each(function(link){ new Control.Modal(link); });
+ }
+ );
+
+
+ JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);");
+
+
- resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views");
+ // without options
+ WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax);
+
+ // with options
+ WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax, "style", "display:inline", "class", "greenForm");
- Will make the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/
-
+ // Class that is going to be used in a SELECT-tag.
+ public class User
+ {
+ private readonly string _realName;
+ private readonly int _id;
+ public User(int id, string realName)
+ {
+ _id = id;
+ _realName = realName;
+ }
+ public string RealName
+ {
+ get { return _realName; }
+ }
+
+ public int Id
+ {
+ get { return _id; }
+ }
+ }
+
+ // Using an inline delegate to generate the select list
+ public void UserInlineDelegate()
+ {
+ List<User> items = new List<User>();
+ items.Add(new User(1, "adam"));
+ items.Add(new User(2, "bertial"));
+ items.Add(new User(3, "david"));
+ string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value)
+ {
+ User user = (User)o;
+ id = user.Id;
+ value = user.RealName;
+ }, 2, true);
+ }
+
+ // Using an method as delegate to generate the select list.
+ public void UseExternalDelegate()
+ {
+ List<User> items = new List<User>();
+ items.Add(new User(1, "adam"));
+ items.Add(new User(2, "bertial"));
+ items.Add(new User(3, "david"));
+ string htmlSelect = Select("users", "users", items, UserOptions, 1, true);
+ }
+
+ // delegate returning id and title
+ public static void UserOptions(object o, out object id, out object title)
+ {
+ User user = (User)o;
+ id = user.Id;
+ value = user.RealName;
+ }
+
+