public void Initialise(ModuleInstanceContext context) { _moduleSettings = context.Settings; Configuration = context.Configuration; User = context.PortalSettings.UserInfo; EditUrlPattern = context.EditUrl(DataTableColumn.RowId.ToString(CultureInfo.InvariantCulture), "{0}", "edit"); }
protected override string ProcessToken(ModuleActionDto model, UserInfo accessingUser, Scope accessLevel) { var title = (!String.IsNullOrEmpty(model.TitleKey) && !String.IsNullOrEmpty(model.LocalResourceFile)) ? Localization.GetString(model.TitleKey, model.LocalResourceFile) : model.Title; SecurityAccessLevel securityAccessLevel = SecurityAccessLevel.View; if (!String.IsNullOrEmpty(model.SecurityAccessLevel)) { switch (model.SecurityAccessLevel) { case "Edit": securityAccessLevel = SecurityAccessLevel.Edit; break; case "Admin": securityAccessLevel = SecurityAccessLevel.Admin; break; case "Host": securityAccessLevel = SecurityAccessLevel.Host; break; default: securityAccessLevel = SecurityAccessLevel.View; break; } } var moduleAction = new ModuleAction(_moduleContext.GetNextActionID()) { Title = title, Icon = model.Icon, Secure = securityAccessLevel }; if (string.IsNullOrEmpty(model.Script)) { moduleAction.Url = _moduleContext.EditUrl(model.ControlKey); } else { moduleAction.Url = model.Script.StartsWith("javascript:", StringComparison.InvariantCultureIgnoreCase) ? model.Script : string.Format("javascript:{0}", model.Script); } _moduleActions.Add(moduleAction); return(String.Empty); }
public override string GenerateUrl(RouteValueDictionary routeValues, ModuleInstanceContext moduleContext) { //Look for a module control string controlKey = (routeValues.ContainsKey("ctl")) ? (string)routeValues["ctl"] : String.Empty; List <string> additionalParams = (from routeValue in routeValues where !ExcludedRouteValues.Split(',').ToList().Contains(routeValue.Key.ToLowerInvariant()) select routeValue.Key + "=" + routeValue.Value) .ToList(); string url; if (String.IsNullOrEmpty(controlKey)) { additionalParams.Insert(0, "moduleId=" + moduleContext.Configuration.ModuleID); url = NavigationManager.NavigateURL("", additionalParams.ToArray()); } else { url = moduleContext.EditUrl(String.Empty, String.Empty, controlKey, additionalParams.ToArray()); } return(url); }
public string EditUrl() { return(ModuleContext.EditUrl()); }
public string EditUrl(string key = "") { return(string.IsNullOrEmpty(key) ? _moduleContext.EditUrl() : _moduleContext.EditUrl(key)); }