public IEnumerable <string> RetrieveContentInjection(CodeInjectionFactory.Locations location, bool allowsCallbacks, AppInfo app, SessionInfo session, Callbacks.CallbackPageContext context)
 {
     foreach (var c in _injectionElements.Where(c => !IsBroken(c)))
     {
         string content = string.Empty;
         if (c.GetLocation() == location)
         {
             var callback = c as AbstractCallback;
             if (callback != null)
             {
                 if (allowsCallbacks)
                 {
                     try {
                         content = callback.RetrieveContentInjection(app, session, context);
                     } catch (Exception e) {
                         RegisterError(callback, CallbackEvent.Unknown, app, e);
                     }
                 }
             }
             else
             {
                 var js = c as InjectedJavascript;
                 if (!app.OsContext.hasDisabledScript(js.Name) && !app.OsContext.hasDisabledScript(""))
                 {
                     content = js.Dump();
                 }
             }
         }
         yield return(content);
     }
 }
Example #2
0
 public InjectedJavascript(string name, string url, string script, CodeInjectionFactory.Locations locationId, int order, string description, bool isActive)
 {
     _name        = name;
     _script      = script;
     _url         = url;
     _order       = order;
     _description = description;
     _isActive    = isActive;
     _locationId  = locationId;
 }
Example #3
0
        private AbstractCallback.EventListener NewCallbackListener(IDataReader reader, List <ICodeInjectionElement> injectionElements)
        {
            AbstractCallbackInvoke invoke = CreateCallbackInvoke(reader);

            CodeInjectionFactory.Locations location = (CodeInjectionFactory.Locations)Enum.Parse(typeof(CodeInjectionFactory.Locations), DataReaderUtils.SafeGet <string>(reader, "CallbackLocation"));
            AbstractCallback callback = CreateCallback(reader, location, invoke) as AbstractCallback;

            callback.HideInProvider = (reader["HIDE_IN_PROVIDER"] != DBNull.Value ? Convert.ToBoolean(reader["HIDE_IN_PROVIDER"]) : false);
            callback.IsLocalizable  = (reader["IS_LOCALIZED"] != DBNull.Value ? Convert.ToBoolean(reader["IS_LOCALIZED"]) : false);
            injectionElements.Add(callback);

            return(CreateCallbackEventListener(reader, callback));
        }
Example #4
0
        private ICodeInjectionElement CreateEctCallback(IDataReader reader, CodeInjectionFactory.Locations locationId, WebServiceCallbackInvoke invoke)
        {
            int id = DataReaderUtils.SafeGet <int>(reader["ID"]);

            switch (Convert.ToString(reader["METHODNAME"]))
            {
            case "GetHtml":
                return(new Callbacks.ECT.ECTGetHtmlCallback(id, locationId, invoke));

            case "ShowFeedback":
                return(new Callbacks.ECT.ECTShowFeedbackCallback(id, locationId, invoke));

            default:
                return(null);
            }
        }
Example #5
0
        private ICodeInjectionElement CreateCallback(IDataReader reader, CodeInjectionFactory.Locations locationId, AbstractCallbackInvoke invoke)
        {
            int id = DataReaderUtils.SafeGet <int>(reader["ID"]);

            if (Convert.ToString(reader["PROVIDERNAME"]) == "ECT_Provider")
            {
                return(CreateEctCallback(reader, locationId, (WebServiceCallbackInvoke)invoke));
            }
            else if (Convert.ToBoolean(reader["IS_VOLATILE"]) == true)
            {
                return(new VolatileContentCallback(id, locationId, (AbstractStringCallbackInvoke)invoke));
            }
            else if (Convert.ToBoolean(reader["IS_STATIC"]) == true)
            {
                return(new StaticContentCallback(id, locationId, (AbstractStringCallbackInvoke)invoke));
            }
            else
            {
                return(new DummyCallback(id, locationId, invoke));
            }
        }
Example #6
0
 public AbstractContentCallback(int callbackId, CodeInjectionFactory.Locations locationId, AbstractStringCallbackInvoke invoke)
     : base(callbackId, locationId, invoke)
 {
 }
 public ECTGetHtmlCallback(int callbackId, CodeInjectionFactory.Locations locationId, Invoke.WebServiceCallbackInvoke invoke)
     : base(callbackId, locationId, invoke)
 {
 }
 public AbstractCallback(int id, CodeInjectionFactory.Locations locationId, AbstractCallbackInvoke invoke)
 {
     _invoke     = invoke;
     _id         = id;
     _locationId = locationId;
 }
 protected string GetInjectedCode(CodeInjectionFactory.Locations position, string webScreenKey, string webScreenName)
 {
     return(AppInfo.GetAppInfo().GetInjectedContent(position, PageAllowsCallbacks(), webScreenKey, webScreenName));
 }
 public DummyCallback(int callbackId, CodeInjectionFactory.Locations locationId, AbstractCallbackInvoke invoke)
     : base(callbackId, locationId, new DummyInvoke())
 {
 }
 public AbstractNotContentCallback(int callbackId, CodeInjectionFactory.Locations locationId, AbstractCallbackInvoke invoke)
     : base(callbackId, locationId, invoke)
 {
     IsLocalizable = false;
 }
 public ECTShowFeedbackCallback(int callbackId, CodeInjectionFactory.Locations locationId, Invoke.WebServiceCallbackInvoke invoke)
     : base(ectCallbackId, locationId, invoke)
 {
 }