예제 #1
0
        //[ChildActionOnly]
        public async Task <ActionResult> GeneralAction(string contenturipattern,
                                                       DataHelpers.SERVER_ACTION_TYPES serverActionType)
        {
            bool bUseContentAction = ViewDataHelper.GetContentAction(serverActionType);
            bool bIsAjaxSubaction  = ViewDataHelper.IsAjaxSubaction(this.Request.HttpContext);

            if (bUseContentAction == true)
            {
                if (bIsAjaxSubaction)
                {
                    return(await this.ContentAjaxAction(contenturipattern));
                }
                else
                {
                    return(await this.ContentAction(contenturipattern));
                }
            }
            else
            {
                if (bIsAjaxSubaction)
                {
                    return(await this.SearchAjaxAction(contenturipattern));
                }
                else
                {
                    return(await this.SearchAction(contenturipattern));
                }
            }
        }
예제 #2
0
        public static bool CanDeleteNode(string currentNode, string okNode,
                                         DataHelpers.SERVER_ACTION_TYPES serveraction, AccountToMember member)
        {
            bool bCanDelete = false;

            if (member != null)
            {
                if (member.AccountId == 0)
                {
                    //anonymous user can edit, but not delete nodes
                    //only owner can delete content
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            bCanDelete = (currentNode == okNode) ? false : true;
            if (serveraction != DataHelpers.SERVER_ACTION_TYPES.edit)
            {
                bCanDelete = false;
            }
            return(bCanDelete);
        }
예제 #3
0
        public void GetNewAction(HttpContext context,
                                 ref DataHelpers.SERVER_ACTION_TYPES serverActionType)
        {
            //url started with one action, but the ajax request might be for another ...
            string sNewContentURIPattern = GetRequestParam(context, CONTENT_PATTERN);

            if (string.IsNullOrEmpty(sNewContentURIPattern))
            {
                sNewContentURIPattern = GetRequestParam(context, Helpers.IOHelper.FILE_UPLOAD_URI);
            }
            if (!string.IsNullOrEmpty(sNewContentURIPattern))
            {
                //don't build a ContentURI because networkname uses a db hit
                string controller            = string.Empty;
                string action                = string.Empty;
                string networkName           = string.Empty;
                string nodeName              = string.Empty;
                string name                  = string.Empty;
                string id                    = string.Empty;
                string fileNameExtensionType = string.Empty;
                string subAction             = string.Empty;
                string subActionView         = string.Empty;
                string variable              = string.Empty;
                ContentURI.GetContentURIParams(sNewContentURIPattern,
                                               out controller, out action,
                                               out networkName, out nodeName, out name,
                                               out id, out fileNameExtensionType, out subAction,
                                               out subActionView, out variable);
                if (!string.IsNullOrEmpty(action))
                {
                    serverActionType = DataHelpers.GetServerAction(action);
                }
            }
        }
예제 #4
0
        public static bool GetContentAction(DataHelpers.SERVER_ACTION_TYPES serverActionType)
        {
            bool bUseContentAction = true;

            if (serverActionType == DevTreks.Data.Helpers.GeneralHelpers.SERVER_ACTION_TYPES.search)
            {
                bUseContentAction = false;
            }
            return(bUseContentAction);
        }
예제 #5
0
        //[HttpPost]
        public async Task <ActionResult> LinkedViews(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ? DataHelpers.MakeURIPatternStart()
                : contenturipattern;
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.linkedviews;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
예제 #6
0
        public async Task <ActionResult> Search(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ?
                                DataHelpers.MakeURIPatternStart() : contenturipattern;
            //check for redirections from ajax content requests or subserveractiontypes
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.search;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
예제 #7
0
 private DataHelpers.SERVER_ACTION_TYPES GetServerActionTypeFromRoute(Microsoft.AspNetCore.Routing.RouteData route)
 {
     DataHelpers.SERVER_ACTION_TYPES eActionType
         = DataHelpers.SERVER_ACTION_TYPES.preview;
     if (route != null)
     {
         string sActionName = route.Values[ACTION].ToString().ToLower();
         eActionType = (string.IsNullOrEmpty(sActionName))
             ? DataHelpers.SERVER_ACTION_TYPES.preview : (DataHelpers.SERVER_ACTION_TYPES)Enum.Parse(typeof(DataHelpers.SERVER_ACTION_TYPES), sActionName);
     }
     else
     {
         //tests end up here
         eActionType = DataHelpers.SERVER_ACTION_TYPES.search;
     }
     return(eActionType);
 }
예제 #8
0
 public async Task <ActionResult> Index()
 {
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("HOMETREKS_TITLE");
         return(View());
     }
     else
     {
         //jquery.ajax form posts to absolute path work around
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }
 public async Task <ActionResult> Index()
 {
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("COMMONTREKS_TITLE");
         return(View());
     }
     else
     {
         //vs2012: upload file forms are submitted here
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }
예제 #10
0
 public async Task <ActionResult> Index()
 {
     //this sets up the 'controller' index page which should be kept separate
     //from the ajax interactive page that follows
     //(easier to reset page when necessary)
     if (this.Request.Method != "POST")
     {
         ViewData["Title"] = AppHelper.GetResource("AGTREKS_TITLE");
         return(View());
     }
     else
     {
         //jquery.ajax form posts to absolute path work around
         string sContenturipattern = string.Empty;
         DataHelpers.SERVER_ACTION_TYPES eServerActionType
             = DataHelpers.SERVER_ACTION_TYPES.edit;
         ViewDataHelper viewHelper = new ViewDataHelper();
         viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
         return(await this.GeneralAction(sContenturipattern, eServerActionType));
     }
 }