Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tabbedView.TabChanged += new EventHandler<TabbedViewEventArgs>(tabbedView_TabChanged);
        //int width = UI.GetClientWindowWidth(WAFContext.Session) - 0;
        //if (width > 949) WAFMaster.EditModule.Width = Unit.Pixel(width);

        if (!IsPostBack) { // setting selected tab based on filename

            if (WAFContext.Request.SpecifiesNodeId) {
                if (WAFContext.Session.NodeExists(WAFContext.Session.CurrentNodeId, true, true)) {
                    CKeyNLR key = new CKeyNLR(WAFContext.Session.CurrentNodeId, WAFContext.Session.LCID, Request["rev"] != null ? int.Parse(Request["rev"]) : 0);
                    ContentBase c = WAFContext.Session.GetContent(key);
                    if (c is SystemUser) {
                        WAFContext.Session.SetModuleSetting("Users", "CurrentTab", "Users", PersistenceScope.UserSession);
                        Response.Redirect("Users.aspx?Open=" + key); return;
                    }
                    if (c is UserGroup) {
                        WAFContext.Session.SetModuleSetting("Users", "CurrentTab", "Groups", PersistenceScope.UserSession);
                        Response.Redirect("Groups.aspx?Open=" + key); return;
                    }
                }
            }

            string fileName = Path.GetFileNameWithoutExtension(Request.PhysicalPath);
            string currentTab = WAFContext.Session.GetModuleSetting<string>("Users", "CurrentTab", PersistenceScope.UserSession, "Users");
            if (fileName != currentTab) Response.Redirect(currentTab + ".aspx"); // redirecting to correct file
            tabbedView.SelectedTabId = fileName;

        }
    }
Beispiel #2
0
    protected override void OnInit(EventArgs e)
    {
        tabbedView.TabChanged += new EventHandler<WAF.Presentation.Web.TabbedViewEventArgs>(tabbedView_TabChanged);
        if (!IsPostBack) { // setting selected tab based on filename
            string currentTab = WAFContext.Session.GetModuleSetting<string>("Blog", "CurrentTab", PersistenceScope.UserSession, "default");
            if (WAFContext.Request.SpecifiesNodeId) {
                if (WAFContext.Session.NodeExists(WAFContext.Session.CurrentNodeId, true, true)) {
                    CKeyNLR key = new CKeyNLR(WAFContext.Session.CurrentNodeId, WAFContext.Session.LCID, Request["rev"] != null ? int.Parse(Request["rev"]) : 0);
                    string s = Request.QueryString.ToString();
                    if (currentTab.ToLower() != "default") {
                        Response.Redirect("default.aspx?Open=" + key + "&" + s); return;
                    }
                }
            }

            string fileName = Path.GetFileNameWithoutExtension(Request.PhysicalPath);
            if (fileName.ToLower() != currentTab.ToLower()) {
                if (Request.QueryString.Count > 0) {
                    Response.Redirect(currentTab + ".aspx?" + Request.QueryString.ToString()); // redirecting to correct file
                } else {
                    Response.Redirect(currentTab + ".aspx"); // redirecting to correct file
                }

            }
            tabbedView.SelectedTabId = fileName;
        }
        MainMenu menu = this.WAFMaster.EditModule.Menu;
        menu.SetMenu(this.GetMenuItems());
        menu.Click += new EventHandler<MainMenuItem>(menu_Click);
        Utils.EnsureClientScriptInclude("jquery-1.6.4.min", Page);
        Utils.EnsureClientScriptInclude("blog-edit", Page);

        base.OnInit(e);
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WAFContext.Session.Access.IsAdmin()) {
            WAFContext.Session.Notify("Only administrators have access to the template module. ");
            Response.Redirect(WAFContext.UrlFromAppToFolderEdit + "Welcome");
            Response.End();
        }
        tabbedView.TabChanged += new EventHandler<TabbedViewEventArgs>(tabbedView_TabChanged);
        //int width = UI.GetClientWindowWidth(WAFContext.Session) - 0;
        //if (width > 949) WAFMaster.EditModule.Width = Unit.Pixel(width);
        if (!IsPostBack) { // setting selected tab based on filename
            if (WAFContext.Request.SpecifiesNodeId) {
                if (WAFContext.Session.NodeExists(WAFContext.Session.CurrentNodeId, true, true)) {
                    CKeyNLR key = new CKeyNLR(WAFContext.Session.CurrentNodeId, WAFContext.Session.LCID, Request["rev"] != null ? int.Parse(Request["rev"]) : 0);
                    ContentBase c = WAFContext.Session.GetContent(key);
                    if (c is MVCTemplate) {
                        WAFContext.Session.SetModuleSetting("Templates", "CurrentTab", "MVCTemplates", PersistenceScope.UserSession);
                        Response.Redirect("MVCTemplates.aspx?Open=" + key); return;
                    } else if (c is Template) {
                        WAFContext.Session.SetModuleSetting("Templates", "CurrentTab", "Templates", PersistenceScope.UserSession);
                        Response.Redirect("Templates.aspx?Open=" + key); return;
                    } else if (c is Stylesheet) {
                        WAFContext.Session.SetModuleSetting("Templates", "CurrentTab", "Stylesheets", PersistenceScope.UserSession);
                        Response.Redirect("Stylesheets.aspx?Open=" + key); return;
                    }
                }
            }
            string fileName = Path.GetFileNameWithoutExtension(Request.PhysicalPath);
            string currentTab = WAFContext.Session.GetModuleSetting<string>("Templates", "CurrentTab", PersistenceScope.UserSession, "Templates");
            if (fileName != currentTab) Response.Redirect(currentTab + ".aspx"); // redirecting to correct file
            tabbedView.SelectedTabId = fileName;

        }
    }
Beispiel #4
0
 public override string Invoke(string input)
 {
     CKeyNLR key = new CKeyNLR(input);
     WMEditContent ec = new WMEditContent(key, true, true, true, false, true, true, false, "Save and close", 500, 650);
     WorkflowInfo wi = Session.StartWorkflowMethod(ec);
     return null;
 }
Beispiel #5
0
    public override string Invoke(string input)
    {
        CKeyNLR key = new CKeyNLR(input);

        WMEditContent ec = new WMEditContent(key, true, true, true, false, true, true, false, Local.Text("Web.WAF.Edit.Webshop.DefaultSaveAndClose"), 500, 650);
        WorkflowInfo wi = Session.StartWorkflowMethod(ec);
        return null;
    }
Beispiel #6
0
 protected void btnDeleteFolder_OnClick(object source, EventArgs e)
 {
     foreach (string value in contentTree.GetSelectedValues()) {
         CKeyNLR key = new CKeyNLR(value);
         if (WAFContext.Session.NodeExists(key.NodeId, true, true)) {
             ContentBase content = WAFContext.Session.GetContent<ContentBase>(key);
             if (!(content is FileLibrary)) deleteFolder((FileFolder)content);
         }
     }
     contentTree.DataBind();
 }
Beispiel #7
0
 protected void btnOpen_Click(object sender, EventArgs e)
 {
     UniqueList<string> lst = lstBin.GetSelectedValues();
     if (lst.Count == 1) {
         CKeyNLR key = new CKeyNLR(lst.GetFirst());
         WAFContext.RedirectToEdit(key);
     } else {
         WAFContext.Session.Notify("Please select one content. ");
     }
     lstBin.DataBind();
 }
Beispiel #8
0
    protected void btnOpen_Click(object sender, EventArgs e)
    {
        UniqueList<string> lst = lstBin.GetSelectedValues();
        if (lst.Count == 1) {
            CKeyNLR key = new CKeyNLR(lst.GetFirst());
            WAFContext.RedirectToEdit(key);
        } else {

            WAFContext.Session.Notify(Local.Text("Web.WAF.Edit.Wastebin.DefaultPleaseSelectOneContent") + " ");
        }
        lstBin.DataBind();
    }
 protected void btnRestartSending_Click(object sender, EventArgs e)
 {
     if (contentListDeliveries.GetSelectedCount() > 0) {
         string strval = contentListDeliveries.GetSelectedValues().GetFirst();
          CKeyNLR key = null;
         if (strval.StartsWith("k")) {
             key = new CKeyNLR(strval);
         } else {
             key = new CKeyNLR(Utils.GetIntegerOnly(strval), WAFContext.Session.LCID, 0);
         }
         HierarchicalContent hc = WAFContext.Session.GetContent<HierarchicalContent>(key);
         if (hc is NewsletterDelivery) {
             NewsletterDelivery delivery = (NewsletterDelivery)hc;
             NewsletterUtil.SendNewsletterToList(delivery.RecipientList.Get(), WAFContext.UrlFromRootToHost, delivery, WAFContext.UrlFromHostToApp, WAFContext.PathFromRootToFolderTemp);
         }
     }
 }
Beispiel #10
0
    public List<string> GetChildren(string key)
    {
        if (key.Contains("|")) {
            return new List<string>();
        }
        var k = new CKeyNLR(key);
        List<string> children = new List<string>();
        if (!WAFContext.Session.ContentExists(k.NodeId)) return children;
        ContentBase c = WAFContext.Session.GetContent(k);
        if (c is Shop) {
            Shop shop = (Shop)c;
            List<PaymentMethod> paymentMethods = shop.PaymentMethods.Query<PaymentMethod>().OrderBy(AqlPaymentMethod.Name, false).Execute();
            foreach (PaymentMethod pm in paymentMethods) {
                children.Add(pm.Key.ToString());
            }
        }

        return children;
    }
Beispiel #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _contextKey = WebDialogueContext.GetDialogueParameter<CKeyNLR>("ContextKey", null);
        instantiateControls();
        if (!IsPostBack) {
            if (Utils.ClientIsIE()) {// IE control focus workaround
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "postbk", "window.setTimeout(function(){__doPostBack();},100);", true);
            }
            string url = WebDialogueContext.GetDialogueParameter<string>("Url", "");
            url = WAFContext.GetNonFriendlyUrlIfRelevant(url);
            bool forceAbsolute = url.Contains(HTMLPropertyValue.AbsoluteMarker);
            if (forceAbsolute) url = url.Replace(HTMLPropertyValue.AbsoluteMarker, "");
            string text = WebDialogueContext.GetDialogueParameter<string>("Text", "");
            string target = WebDialogueContext.GetDialogueParameter<string>("Target", null);
            string anchor;
            url = HTMLPropertyValue.ExtractAnchor(url, out anchor);
            txtAnchor.Text = anchor;

            ddlLinkType.SelectedValue = getLinkType(ref url).ToString();

            chkAbsolute.Checked = forceAbsolute;
            txtAddress.Text = url;

            chkAbsolute_CheckedChanged(null, EventArgs.Empty);

            chkNewWindow.Checked = target.Length > 0;
            txtContent.Text = text;
            updateAddressControls();
            if (text.Contains("<") && text.Contains(">")) {
                txtContent.Visible = false;
                pnlContent.Visible = true;
                pnlContent.ScrollBars = ScrollBars.Auto;
                litContent.Text = text;
            } else {
                txtContent.Visible = true;
                txtContent.Text = HttpUtility.HtmlDecode(txtContent.Text);
                pnlContent.Visible = false;
            }
        }
        chkAbsolute.CheckedChanged += new EventHandler(chkAbsolute_CheckedChanged);
        initWorkflowMethods();
    }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack && Request["Open"] != null) {
         CKeyNLR key = new CKeyNLR(Request["Open"]);
         cntFrm.ContentKey = key;
         tabbedView.Visible = true;
         SystemUser s = WAFContext.Session.GetContent<SystemUser>(key);
         userList.SetSelected(s.Key.ToString());
     }
     setQueryList();
     refreshTabs();
 }
Beispiel #13
0
 protected override void OnInit(EventArgs e)
 {
     btnNew.SetWorkflowMethod<NewSegment>(null, null, false, false, true, null);
     _tree = new SegmentationTree();
     _tree.PostOnClick = true;
     _tree.Click += new EventHandler(segmentationTree_DblClick);
     _tree.Drop += new EventHandler(segmentationTree_Drop);
     _tree.Remove += new EventHandler(segmentationTree_Remove);
     _tree.AllowDropBetweenElements = true;
     _tree.AllowDropOnElements = true;
     _tree.AllowRemoveDrag = false;
     pnlTree.Controls.Add(_tree);
     if (Request["nid"] != null) {
         int nid = Utils.GetIntegerOnly(Request["nid"]);
         if (nid > 0 && WAFContext.Session.ContentExists(nid)) {
             contentForm.NodeId = nid;
             contentForm.Refresh();
             _tree.SetSelected(nid);
             CKeyNLR key = new CKeyNLR(nid, WAFContext.Request.LCID, 0);
             _tree.SetSelected(nid);
         }
     }
     base.OnInit(e);
 }
Beispiel #14
0
 void btnRemoveFilter_Click(object sender, EventArgs e)
 {
     WAFContext.Session.DeleteNode(filterKey.NodeId, true);
     filterKey = null;
     WFContext.RefreshWindow(WebDialogueContext.Exchange.Id);
 }
Beispiel #15
0
 void btnAddFilter_Click(object sender, EventArgs e)
 {
     QueryFilter filter = WAFContext.Session.NewContent<QueryFilter>();
     filter.UpdateChanges();
     filterKey = filter.Key.CreateCKeyNLR();
     btnEditFilter_Click(sender, e);
 }
Beispiel #16
0
    protected void btnNewFolder_OnComplete(object source, WorkflowInfo info)
    {
        int selectedFolderId = -1;
        if (chkTreeview.Checked) {
            if (contentTree.GetSelectedCount() > 0) {
                selectedFolderId = new CKeyNLR(contentTree.GetSelectedValues().GetFirst()).NodeId;
            }
        }

        CKeyNLRC key = (CKeyNLRC)info.OutputParameters["NewContentKeyC"];
        if (key != null) {
            ContentBase newContent = WAFContext.Session.GetContent<ContentBase>(key);
            if (newContent is ContentFile && selectedFolderId > -1) {
                ((ContentFile)newContent).Folder.Set(selectedFolderId);
                newContent.UpdateChanges();
            }
            if (newContent is FileFolder && selectedFolderId > -1) {
                ((FileFolder)newContent).ParentFolder.Set(selectedFolderId);
                contentTree.DataBind();
                newContent.UpdateChanges();
            }
            contentTree.SetSelected(key.NodeId);
            contentTree.DataBind();
        }
    }
Beispiel #17
0
    public override NextCall Invoke(WorkflowMethod invoker)
    {
        _action = GetSecureInput<AddressAction>();

        var q = Session.CreateQuery();

        var alias = new AqlAliasContentBase();
        alias.IgnoreSessionCulture = true;
        var rNodeId = q.Select(alias.NodeId);
        var rLCID = q.Select(alias.LCID);
        q.Select(alias);
        q.Where(alias.IsDerived == false);
        q.Where(alias.TemplateId > 0);
        q.From(alias);
        AqlResultSet rs = q.Execute();

        int nn = 0;
        switch (_action) {
            case AddressAction.RegeneratingAutomaticAddresses: WFContext.Caption = "Regenerating automatic addresses..."; break;
            case AddressAction.SettingAddressesToAutomatic: WFContext.Caption = "Setting addresses to automatic..."; break;
            case AddressAction.EnsuringAddressesAreValid: WFContext.Caption = "Ensuring addresses are valid..."; break;
            default: break;
        }
        WFContext.InBackgroundMode = false;
        WFContext.EstimateProgress = true;
        while (rs.Read()) {
            nn++;
            var key = new CKeyNLR(rNodeId.Value, rLCID.Value, 0);
            WFContext.Description = "Updating " + nn + " of " + rs.RowCount + "...";
            WFContext.SetProgress(nn, rs.RowCount);
            var c = Session.GetContent(key);
            if (WFContext.BreakExecution) return null;
            try {
                switch (_action) {
                    case AddressAction.RegeneratingAutomaticAddresses:
                        if (c.Address.Length == 0) c.Address = "#";
                        if (c.Address.StartsWith("#")) c.UpdateChanges();
                        break;
                    case AddressAction.SettingAddressesToAutomatic:
                        Engine.SetNodeAddressesToAutomatic(new List<CKeyNLRC>(new CKeyNLRC[] { c.Key }));
                        break;
                    case AddressAction.EnsuringAddressesAreValid:
                        c.EnsureAddressUniqueness();
                        c.UpdateChanges(false, false, false);
                        break;
                    default:
                        break;
                }
            } catch (Exception errr) {
                WAFRuntime.Log(errr);
            }
        }
        Session.Engine.ClearCache();
        WFContext.Notify(Utils.GetFriendlyName(_action.ToString()) + " completed successfully");
        return null;
    }
Beispiel #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DialogueMasterPage master = (DialogueMasterPage)this.Master;
        if (master.Exchange == null) return;
        contentTree.RelationId = AqlRelFilefolders.Relation.RelationId;

        List<FileLibrary> libs = WAFContext.Session.GetContents<FileLibrary>();
        if (libs.Count == 0) {
            FileLibrary newlib = WAFContext.Session.NewContent<FileLibrary>();
            newlib.UpdateChanges();
            newlib.Name = "Library";
            contentTree.RootKey = newlib.Key;
        } else {
            contentTree.RootKey = new UniqueList<FileLibrary>(libs).GetFirst().Key;
        }

        UniqueList<int> classIds = null;
        UniqueList<int> classIds2 = new UniqueList<int>();
        UniqueList<MemDefContentClass> contDefList;
        if (master.Exchange.DialogueParameters.ContainsKey("ClassIds")) {
            contDefList = new UniqueList<MemDefContentClass>();
            classIds = (UniqueList<int>)master.Exchange.DialogueParameters["ClassIds"];
            foreach (int id in classIds) {
                foreach (int id2 in WAFContext.Engine.Definition.ContentClass[id].AllDescendantsIncThis) {
                    if (!classIds2.Contains(id2)) {
                        classIds2.Add(id2);
                        contDefList.Add(WAFContext.Engine.Definition.ContentClass[id2]);
                    }
                }
            }
            classIds = classIds2;
        } else {
            contDefList = new UniqueList<MemDefContentClass>();
            foreach (MemDefContentClass classDef in WAFContext.Engine.Definition.ContentClass.Values) contDefList.Add(classDef);
        }

        if (!IsPostBack) {
            updateTypeList();
            txtSearch.Text = (string)master.Exchange.DialogueParameters["SearchString"];

            if (master.Exchange.DialogueParameters.ContainsKey("ViewMode")) {
                contentList.ViewMode = (ListViewOptions)master.Exchange.DialogueParameters["ViewMode"];
                chkThumbnails.Checked = contentList.ViewMode == ListViewOptions.Thumbnails;
            }

            //chkFilter.Checked = txtSearch.Text.Length > 0;
            chkTreeview_CheckedChanged(null, null);
            chkFilter_CheckedChanged(null, null);
            //foreach (MemDefRelation rel in WAFContext.Session.Definitions.Relation.Values) {
            //    ListItem item = new ListItem(rel.GetName(WAFContext.Session), rel.Id.ToString());
            //    lstTreeviewRelation.Items.Add(item);
            //}

        }
        if (contentList.ViewMode != ListViewOptions.List) {
            contentList.ViewMode = chkThumbnails.Checked ? ListViewOptions.Thumbnails : ListViewOptions.Details;
        }
        int nodeId = 0;
        if (int.TryParse(txtSearch.Text + "", out nodeId)) {
            if (WAFContext.Session.NodeExists(nodeId, true, true)) {
                UniqueList<CKeyNLRC> result = new UniqueList<CKeyNLRC>();
                result.Add(WAFContext.Session.GetContent(nodeId).Key);
                master.SendResult(result);
                Response.End();
            }
        }

        AqlQuery query = WAFContext.Session.CreateQuery();
        AqlAliasContentBase alias;
        int selectedFolderId = -1;
        if (chkTreeview.Checked) {
            AqlAliasFileFolder parent = new AqlAliasFileFolder();
            parent.AssignNoneAliasFields = false;
            alias = new AqlAliasContentFile();
            AqlAliasRelation relation = new AqlAliasRelation(parent, alias, AqlRelFolderFiles.Relation);
            query.From(relation);
            if (contentTree.GetSelectedCount() > 0) {
                selectedFolderId = new CKeyNLR(contentTree.GetSelectedValues().GetFirst()).NodeId;
            }
            query.Where(parent.NodeId == selectedFolderId);
        } else {
            alias = new AqlAliasContentBase(0);
            query.From(alias);
        }
        query.Select(alias);
        query.Select(alias.Name, "Name");
        query.Select(alias.ChangeDate, "ChangedDate");
        query.OrderBy(alias.Name);
        if (master.Exchange != null) {
            if (master.Exchange.DialogueParameters.ContainsKey("WhereExpression")) {
                AqlExpressionBoolean where = (AqlExpressionBoolean)master.Exchange.DialogueParameters["WhereExpression"];
                if (((object)where) != null) query.Where(where);
            }
        }
        int classId = 0;

        if (int.TryParse(ddlFilter.SelectedValue, out classId)) { // if selected
            //query.Where(AqlContent.ContentClassId == classId);
            query.Where(Aql.In(alias.ContentClassId, WAFContext.Session.Definitions.ContentClass[classId].AllDescendantsIncThis));
        } else { // if not, return all in list or omit if no class is specified to dialogue
            if (classIds != null) query.Where(Aql.In(alias.ContentClassId, classIds));
        }
        if (chkHideOtherLangs.Checked) {
            query.Where(alias.IsDerived == false);
        }
        if (txtSearch.Text.Length > 0) {
            if (int.TryParse(txtSearch.Text, out nodeId)) {
                query.Where(alias.NodeId == nodeId);
            } else {
                query.Where(Aql.Like(alias.Name, "*" + txtSearch.Text + "*"));
            }
        }
        contentList.Query = (query);

        if (!IsPostBack) {
            query.RetrieveTotalCount = true;
            query.PageSize = contentList.PageSize;
        }

        btnNewFolder.AddInputParameters("ChooseHierarchyPosition", false);
        btnNewFolder.AddInputParameters("EditAfterCreate", true);
        btnNewFolder.AddInputParameters("EditInNewWindow", true);
        btnNewFolder.AddInputParameters("ClassIds", WAFContext.Engine.Definition.ContentClass[FileFolder.ContentClassId].AllDescendantsIncThis.ToList());

        btnNewContent.AddInputParameters("ChooseHierarchyPosition", false);
        btnNewContent.AddInputParameters("EditAfterCreate", true);
        btnNewContent.AddInputParameters("EditInNewWindow", true);
        btnNewContent.AddInputParameters("ClassIds", classIds);

        bool fileUpload = (bool)master.Exchange.DialogueParameters["FileUpload"];
        if (fileUpload) {
            btnUpload.AddInputParameters("ParentFolderNodeId", selectedFolderId);
            btnUpload.AddInputParameters("FileUploadType", FileUploadType.ContentFileUpload);
            btnUpload.AddInputParameters("Multiple", true);
            btnUploadArchive.WorkflowType = typeof(WAF.Engine.Workflow.FileUpload);
            btnUploadArchive.AddInputParameters("ParentFolderNodeId", selectedFolderId);
            btnUploadArchive.AddInputParameters("FileUploadType", FileUploadType.ContentFileUploadZipped);
            btnUploadArchive.AddInputParameters("Multiple", false);
        }

        master.AddDialogueButton(btnSelect);
        // contentTree.PersistenceKey = "Tree";
    }
Beispiel #19
0
 public bool IsSelectable(string key)
 {
     if (key.Contains("|")) {
         return true;
     }
     var k = new CKeyNLR(key);
     if (!WAFContext.Session.ContentExists(k.NodeId)) return false;
     ContentBase c = WAFContext.Session.GetContent(k);
     if (c is Shop) {
         return false;
     }
     return true;
 }
Beispiel #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _key = WebDialogueContext.GetDialogueParameter<CKeyNLR>("ContentKey", null);
        _classIds = WebDialogueContext.GetDialogueParameter<UniqueList<int>>("ClassIds", null);
        _selectionMode = WebDialogueContext.GetDialogueParameter<ListSelectionMode>("SelectionMode", ListSelectionMode.Multiple);

        // add all inherited classes aswell:
        UniqueList<int> newClassIds = new UniqueList<int>();
        foreach (int id in _classIds) {
            MemDefContentClass clDef = WAFRuntime.Definitions.ContentClass[id];
            foreach (int id2 in clDef.AllDescendantsIncThis) {
                if (!newClassIds.Contains(id2)) newClassIds.Add(id2);
            }
        }
        _classIds = newClassIds;

        MainButton mb = new MainButton();

        mb.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnOk");
        mb.Click += new EventHandler(mb_Click);
        Controls.Add(mb);
        WebDialogueContext.AddDialogueButton(mb);
        _paths = new List<PropertyPath>();
        WMSelectFileToEditor.RetrieveAllRelevantPaths(WAFContext.Session.GetContent(_key), _paths, _classIds);
        _values = new List<FilePropertyValue>();
        _selectedIndexes = new UniqueList<int>();
        int n = 0;
        foreach (PropertyPath p in _paths) {
            _values.Add(WAFContext.Session.GetProperty<FilePropertyValue>(p));
            if (Request["chk" + n] != null) _selectedIndexes.Add(n);
            n++;
        }
        if (_values.Count == 0) {
           WebDialogueContext.Session.Notify(Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentNotifyThereAreNoFile"), Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentYouMustUploadAFile"));
            WebDialogueContext.SendResult(new List<PropertyPath>());
        }
        if (n > 3) {
            MainButton btnCheckAll = new MainButton();
            btnCheckAll.Click += new EventHandler(btnCheckAll_Click);

            btnCheckAll.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnCheckAll");
            Controls.Add(btnCheckAll);
            WebDialogueContext.AddDialogueButton(btnCheckAll);
        }
    }
Beispiel #21
0
    protected override void OnPreRender(EventArgs e)
    {
        if (Request["open"] != null) {
            string key = Request["open"].ToString();
            CKeyNLR key1 = new CKeyNLR(key);
            ContentForm1.NodeId = key1.NodeId;
            ContentForm1.Refresh();
            _treeControl.SetSelected(key1.NodeId);
        } else if (WAFContext.Session.CurrentNodeId > 0 && WAFContext.Request.SpecifiesNodeId) {
            ContentForm1.NodeId = WAFContext.Session.CurrentNodeId;
            ContentForm1.Refresh();
            _treeControl.SetSelected(WAFContext.Session.CurrentNodeId);
        }

        if (WAFShopHelper.SiteHasShop(WAFContext.Request.SiteId)) {
            _treeControl.ShopId = WAFShopHelper.GetCurrentShopId();
            _treeControl.Refresh();
        }
        base.OnPreRender(e);
    }
Beispiel #22
0
    protected override void OnInit(EventArgs e)
    {
        _treeControl = new BlogTree();
        _treeControl.AllowSelect = true;
        _treeControl.AllowDrag = false;
        _treeControl.DblClick += new EventHandler(_treeControl_DblClick);
        pnlMenu.Controls.Add(_treeControl);

        if (Request["open"] != null) {
            string key = Request["open"].ToString();
            CKeyNLR nodeKey = new CKeyNLR(key);
            ContentForm1.NodeId = nodeKey.NodeId;
        } else if (WAFContext.Session.CurrentNodeId > 0 && WAFContext.Request.SpecifiesNodeId) {
            ContentForm1.NodeId = WAFContext.Session.CurrentNodeId;
            _treeControl.SetSelected(WAFContext.Session.CurrentNodeId);
            _treeControl.Open(WAFContext.Request.GetContent().Key.ToString());

        } else if (ContentForm1.NodeId > 0) {
            _treeControl.Open(WAFContext.Request.GetContent().Key.ToString());
        }

        base.OnInit(e);
    }
Beispiel #23
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     CKeyNLR key = new CKeyNLR(this.GetUnsecureInput<string>("Key"));
     return new NextCall(new WMEditContent(key, true));
 }
Beispiel #24
0
    protected void contentListProducts_DblClick(object sender, EventArgs e)
    {
        UniqueList<string> selected = contentListProducts.GetSelectedValues();
        if (selected.Count == 1) {
            CKeyNLR key = new CKeyNLR(contentListProducts.GetSelectedValues().GetFirst());

            //open edit dialogue
        }
    }
Beispiel #25
0
 protected void contentTree_DblClick(object sender, EventArgs e)
 {
     if (contentTree.GetSelectedValues().Count == 1) {
         //mainContentEdit.ContentKey = new CKeyNLR(contentTree.GetSelectedValues().GetFirst());
         CKeyNLR key = new CKeyNLR(contentTree.GetSelectedValues().GetFirst());
         contentForm.NodeId = key.NodeId;
         ContentBase c = WAFContext.Session.GetContent(key);
         contentForm.Refresh();
         if (!WAFContext.Session.Access.IsMember(c.EditAccessGroupId)) {
             if (contentForm.ContainsGroupControl("Main")) {
                 Control ctrl = contentForm.GetGroupControl("Main");
                 if (ctrl is TabbedView) {
                     TabbedView tv = (TabbedView)ctrl;
                     tv.SelectedTabId = "Children";
                 }
             }
         }
     } else {
         contentForm.NodeId = 0;
         contentForm.Refresh();
     }
 }
Beispiel #26
0
 public override string Invoke(string input)
 {
     CKeyNLR key = new CKeyNLR(input);
     MessageBase m = Session.GetContent<MessageBase>(key);
     m.Read = true;
     m.UpdateChanges();
     //Session.QueUIAction(new UIActionRefreshPage(Guid.Empty));
     WMEditContent ec = new WMEditContent(key, true);
     Session.StartWorkflowMethod(ec);
     return null;
 }
Beispiel #27
0
 void menu_Click(object sender, MainMenuItem e)
 {
     try {
         initLinkGraph();
         //MainMenu menu = WAFMaster.EditModule.Menu;
         contentTree.IncludeDeleted = WAFMaster.EditModule.Menu.IsItemChecked("View_Deleted");
         contentForm.IncludeDeleted = WAFMaster.EditModule.Menu.IsItemChecked("View_Deleted");
         contentTree.IncludeUnpublished = WAFMaster.EditModule.Menu.IsItemChecked("View_Unpublished");
         contentTree.ShowIDs = WAFMaster.EditModule.Menu.IsItemChecked("View_IDs");
         contentForm.IncludeUnpublished = WAFMaster.EditModule.Menu.IsItemChecked("View_Unpublished");
         if (e.Id == "Content_NewSelected") {
             foreach (string skey in contentTree.GetSelectedValues()) {
                 CKeyNLR key = new CKeyNLR(skey);
                 if (WAFContext.Session.NodeExists(key.NodeId, true, true)) {
                     HierarchicalContent hContent = WAFContext.Session.GetContent<HierarchicalContent>(key.NodeId);
                     HierarchicalContent hNewContent = (HierarchicalContent)WAFContext.Session.NewContent(hContent.ClassId);
                     hNewContent.Name = WAFContext.Session.Definitions.ContentClass[hContent.ClassId].GetName(WAFContext.Session);
                     if (hContent.Parent.IsSet()) hNewContent.Parent.Set(hContent.Parent.GetKey());
                     hNewContent.UpdateChanges();
                 }
             }
         } else if (e.Id == "Translate") {
             WAFContext.StartWorkflowMethod(new Translate());
         } else if (e.Id == "View_AdvancedPropertyOptions") {
             if (contentForm.Content != null) WAFContext.RedirectToEdit(contentForm.ContentKey);
         } else if (e.Id == "Content_Delete") {
             deleteContents m = new deleteContents();
             m.Keys = new List<CKeyNLR>();
             foreach (string skey in contentTree.GetSelectedValues()) m.Keys.Add(new CKeyNLR(skey));
             string msg = "Delete " + m.Keys.Count + " content(s) and their children to the wastebin?";
             WAFContext.StartWorkflowMethod(m, msg);
         }
     } catch (Exception error) {
         WAFContext.Session.Notify(DialogueIcon.Info, "This is not possible", error.Message);
     }
 }
Beispiel #28
0
 protected void paymentMethodTree_Click(object sender, EventArgs e)
 {
     string key = _tree.GetSelectedValues().GetFirst();
     if (key.Contains("|")) {
         string[] keys = key.Split('|');
         if (keys.Length > 1) {
             //parentKey = keys[0];
             key = keys[1];
         }
     }
     CKeyNLR ckey = new CKeyNLR(key);
     ContentForm1.NodeId = ckey.NodeId;
     ContentForm1.Visible = true;
     ContentForm1.Refresh();
 }
Beispiel #29
0
    protected override void OnInit(EventArgs e)
    {
        _treeControl = new TemplateTree();
        _treeControl.RootFolder = WAFContext.PathFromRootToAppFolder;
        _treeControl.AllowSelect = true;
        _treeControl.AllowDrag = false;
        _treeControl.DblClick += new EventHandler(_treeControl_DblClick);
        pnlLeft.Controls.Add(_treeControl);
        cntFrm.CommandClick += new EventHandler<CommandArgument>(cntFrm_CommandClick);
        WAFPanel p1 = new WAFPanel();
        p1.Width = Unit.Percentage(100);
        p1.Height = Unit.Pixel(26);
        p1.Border = false;
        p1.Margin = true;
        MainButton saveAspx = new MainButton();
        saveAspx.Click += new EventHandler(saveAspx_Click);

        saveAspx.Text = Local.Text("Web.WAF.Edit.Templates.TemplatesSaveChanges");
        p1.Controls.Add(saveAspx);
        tabASPXFile.Controls.Add(p1);

        _aspxFileEditor = new CodeEditor();
        _aspxFileEditor.Width = Unit.Percentage(100);
        _aspxFileEditor.Height = Unit.Percentage(100);
        _aspxFileEditor.Language = "html";
        tabASPXFile.Controls.Add(_aspxFileEditor);

        WAFPanel p2 = new WAFPanel();
        p2.Width = Unit.Percentage(100);
        p2.Height = Unit.Pixel(26);
        p2.Border = false;
        p2.Margin = true;

        MainButton saveCodebehind = new MainButton();
        saveCodebehind.Click += new EventHandler(saveCodebehind_Click);
        saveCodebehind.Text = Local.Text("Web.WAF.Edit.Templates.TemplatesSaveChanges");

        _codebehindEditor = new CodeEditor();
        _codebehindEditor.Width = Unit.Percentage(100);
        _codebehindEditor.Height = Unit.Percentage(100);
        _codebehindEditor.Language = "cs";
        tabCodebindFile.Controls.Add(p2);
        tabCodebindFile.Controls.Add(_codebehindEditor);
        p2.Controls.Add(saveCodebehind);

        TemplatesMaster.ViewChanged += new EventHandler<MainMenuItem>(TemplatesMaster_ViewChanged);
        btnCreateTemplate.Click += new EventHandler(btnCreateTemplate_Click);

        if (!IsPostBack && Request["Open"] != null) {
            CKeyNLR key = new CKeyNLR(Request["Open"]);
            cntFrm.ContentKey = key;
            tabbedView.Visible = true;
            Template s = WAFContext.Session.GetContent<Template>(key);
            string treeKey = s.Filepath + "." + s.NodeId + ".";

            if (WAFRuntime.FileSystem.FileExists(WAFContext.PathFromRootToAppFolder + s.Filepath)) {
                treeKey += "match#";
            } else {
                treeKey += "onlyContent#";
            }
            _treeControl.SetSelected(treeKey);
            _treeControl.Refresh();
            updateCodeEditors(s.Filepath);
            cntFrm.Refresh();
        }

        base.OnInit(e);
    }
Beispiel #30
0
    protected override void OnInit(EventArgs e)
    {
        SetTabAccessRights();

        tabbedView.TabChanged += new EventHandler<WAF.Presentation.Web.TabbedViewEventArgs>(tabbedView_TabChanged);
        if (!IsPostBack) { // setting selected tab based on filename
            string currentTab = WAFContext.Session.GetModuleSetting<string>("Webshop", "CurrentTab", PersistenceScope.UserSession, "default");
            if (WAFContext.Request.SpecifiesNodeId) {
                if (WAFContext.Session.NodeExists(WAFContext.Session.CurrentNodeId, true, true)) {
                    CKeyNLR key = new CKeyNLR(WAFContext.Session.CurrentNodeId, WAFContext.Session.LCID, Request["rev"] != null ? int.Parse(Request["rev"]) : 0);
                    ContentBase c = WAFContext.Session.GetContent(key);
                    string s = Request.QueryString.ToString();
                    if (c is ProductBase) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "ProductsPage", PersistenceScope.UserSession);
                        if (currentTab != "ProductsPage") {
                            Response.Redirect("ProductsPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is ProductCategory) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "ProductCategoriesPage", PersistenceScope.UserSession);
                        if (currentTab != "ProductCategoriesPage") {
                            Response.Redirect("ProductCategoriesPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is Order) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "OrdersPage", PersistenceScope.UserSession);
                        if (currentTab != "OrdersPage") {
                            Response.Redirect("OrdersPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is OrderItem) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "OrdersPage", PersistenceScope.UserSession);
                        if (currentTab != "OrdersPage") {
                            Response.Redirect("OrdersPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is Manufacturer) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "ManufacturersPage", PersistenceScope.UserSession);
                        if (currentTab != "ManufacturersPage") {
                            Response.Redirect("ManufacturersPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is DiscountBase) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "DiscountsPage", PersistenceScope.UserSession);
                        if (currentTab != "DiscountsPage") {
                            Response.Redirect("DiscountsPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is ShippingMethod) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "ShippingPage", PersistenceScope.UserSession);
                        if (currentTab != "ShippingPage") {
                            Response.Redirect("ShippingPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is PaymentMethod) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "PaymentPage", PersistenceScope.UserSession);
                        if (currentTab != "PaymentPage") {
                            Response.Redirect("PaymentPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                    if (c is Shop) {
                        WAFContext.Session.SetModuleSetting("Webshop", "CurrentTab", "ShopPage", PersistenceScope.UserSession);
                        if (currentTab != "ShopPage") {
                            Response.Redirect("ShopPage.aspx?Open=" + key + "&" + s); return;
                        }
                    }
                }
            }

            //string fileName = Path.GetFileNameWithoutExtension(Request.PhysicalPath);
            //string currentTab = WAFContext.Session.GetModuleSetting<string>("Users", "CurrentTab", PersistenceScope.UserSession, "Users");
            //if (fileName != currentTab) Response.Redirect(currentTab + ".aspx"); // redirecting to correct file
            //tabbedView.SelectedTabId = fileName;
            string fileName = Path.GetFileNameWithoutExtension(Request.PhysicalPath);
            if (fileName.ToLower() != currentTab.ToLower()) {
                if (Request.QueryString.Count > 0) {
                    Response.Redirect(currentTab + ".aspx?" + Request.QueryString.ToString()); // redirecting to correct file
                } else {
                    Response.Redirect(currentTab + ".aspx"); // redirecting to correct file
                }

            }
            tabbedView.SelectedTabId = fileName;
            // this.ShopId = WAFShopHelper.GetCurrentShopId();
        }
        EditModule module = (EditModule)WAFMaster.FindControl("editModule");
        module.LanguageChanged += new EventHandler(module_LanguageChanged);
        module.SiteChanged += new EventHandler(module_SiteChanged);
        MainMenu menu = this.WAFMaster.EditModule.Menu;
        menu.SetMenu(this.GetMenuItems());
        menu.Click += new EventHandler<MainMenuItem>(menu_Click);
        //  if (Request["shopid"] != null) ShopId = Utils.GetIntegerOnly(Request["shopid"]);
        base.OnInit(e);
    }