public override string output(Asset asset, OutputContext context, string name, string index = "")
        {
            var output = new StringBuilder();

            // Establish content field names
            EnsureContentFieldNames(name, index);

            // Establish input form field and element attribute names
            var editableAttributes = Util.Editable(_moduleInstanceIdField);

            // Add supporting css/js and an editor wrapper for edit mode only
            if (!context.IsPublishing)
            {
                if (!IsWidgetMode)
                {
                    output.Append("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">");
                    output.Append("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js\"></script>");
                    output.Append("<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>");
                }
                output.Append("<span " + editableAttributes + "><div style=\"visibility:hidden;height:0px;width:0px;\">editor_placeholder</div>");
            }

            if (asset.GetContentFields().ContainsKey(_moduleInstanceIdField) && !string.IsNullOrEmpty(asset[_moduleInstanceIdField]))
            {
                EnsureConfigSettings(asset);
                _authToken = Ih_AuthenticationHelper.GetAuthToken(true, context.UserInfo, _configSettings);

                var moduleInstanceId = asset[_moduleInstanceIdField];
                var prerenderMarkup = Boolean.Parse(GetValueOrDefault(asset[_prerenderMarkupFieldName], true.ToString())) || (IsWidgetMode && !context.IsPublishing);

                IncrementModuleInstanceIndex(context, !prerenderMarkup);

                // Render module instance markup
                if (context.IsPublishing || IsWidgetMode)
                    RenderModuleOutputForWeb(asset, context, output, moduleInstanceId, prerenderMarkup);
                else
                    RenderModuleOutputForCms(context, output, moduleInstanceId, name, index);
            }
            else
            {
                if (!context.IsPublishing)
                    output.Append("<div style=\"border:1px solid lightgray;color:gray;padding:5px;text-align:center\">No Module Instance Selected</div>");
            }

            // Finalize editor wrapper
            if (!context.IsPublishing)
                output.Append("</span>");

            return output.ToString();
        }
        public override string output(Asset asset, OutputContext context, string name, string index = "")
        {
            var output = new StringBuilder();

            // Establish content field names
            EnsureContentFieldNames(name, index);

            // Establish user variable names
            EnsureUserVariableNames(context);

            // Establish input form field and element attribute names
            var editableAttributes = Util.Editable(_moduleInstanceIdField);

            // Add wrapper for edit mode only
            if (!context.IsPublishing)
                output.Append("<span " + editableAttributes + "><div style=\"visibility:hidden;height:0px;width:0px;\">editor_placeholder</div>");

            if (asset.GetContentFields().ContainsKey(_moduleInstanceIdField) && !string.IsNullOrEmpty(asset[_moduleInstanceIdField]))
            {
                EnsureConfigSettings(asset);
                _authToken = Ih_AuthenticationHelper.GetAuthToken(false, context.UserInfo, _configSettings);

                var moduleInstanceId = asset[_moduleInstanceIdField];
                var prerenderMarkup = Boolean.Parse(GetValueOrDefault(asset[_prerenderMarkupFieldName], true.ToString()));

                IncrementModuleInstanceIndex(context, !prerenderMarkup);

                // Render module instance markup
                if (context.IsPublishing)
                    RenderModuleOutputForWeb(asset, context, output, moduleInstanceId, prerenderMarkup);
                else
                    RenderModuleOutputForCms(asset, context, output, moduleInstanceId, name, index);
            }
            else
            {
                if (!context.IsPublishing)
                    output.Append("<div style=\"border:1px solid lightgray;color:gray;padding:5px;text-align:center\">No Module Instance Selected</div>");
            }

            // Finalize editor wrapper
            if (!context.IsPublishing)
                output.Append("</span>");

            return output.ToString();
        }
        public override string output(Asset asset, OutputContext context, string name, string index = "")
        {
            var output = new StringBuilder();

            // Ensure admin UI is never published
            if (context.IsPublishing)
                return string.Empty;

            // Get all site roots that the current user is allowed to access
            _allowedSiteRoots = FindAllowedSiteRoots(context);

            // Get selected site root asset Id
            if (context.PublishingArgs.HasArg(_siteRootAssetIdParam))
                _selectedSiteRootAssetId = int.Parse(context.PublishingArgs[_siteRootAssetIdParam]);

            // Load content app intance configuration
            if (!EnsureConfigSettings(asset))
            {
                return CreateErrorMessage("You are not authorized to administrate Content Apps.");
            }

            // Acquire an authentication token
            var token = Ih_AuthenticationHelper.GetAuthToken(true, context.UserInfo, _configSettings);

            // Render iframe containing content apps admin
            var startPageFieldNameComplete = name + _startPageFieldName + index;

            if (asset.GetContentFields().ContainsKey(startPageFieldNameComplete))
            {
                var adminUrl = asset[startPageFieldNameComplete];

                if (!string.IsNullOrEmpty(adminUrl))
                    output.AppendLine(GetAdminIFrameMarkup(asset, context, adminUrl, token));
            }
            else
            {
                return CreateErrorMessage("No Start Page URL was configured");
            }

            return output.ToString();
        }