protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/javascript";
        // initialize additional variables for later use
        m_refMsg = m_refSiteApi.EkMsgRef;

        // instantiate contentAPI reference
        ContentAPI contentApi = new ContentAPI();

        // assign the resource text values as needed
        jsCancel.Text = m_refMsg.GetMessage("generic cancel");
        jsDropControlHere.Text = m_refMsg.GetMessage("lbl pagebuilder drop control here");
        jsEm.Text = m_refMsg.GetMessage("generic em");
        jsNewWidth.Text = m_refMsg.GetMessage("lbl pagebuilder new width");
        jsPixels.Text = m_refMsg.GetMessage("generic pixels");
        jsPercent.Text = m_refMsg.GetMessage("generic percent");
        jsSave.Text = m_refMsg.GetMessage("generic save");
        jsWidget.Text = m_refMsg.GetMessage("generic widget");
    }
Beispiel #2
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refSiteApi.EkMsgRef;
        Utilities.ValidateUserLogin();
        if (m_refSiteApi.RequestInformationRef.IsMembershipUser == 1 || m_refSiteApi.RequestInformationRef.UserId == 0)
        {
            Response.Redirect(m_refSiteApi.ApplicationPath + "reterror.aspx?info=" + Server.UrlEncode(m_refMsg.GetMessage("msg login cms user")), false);
            return;
        }
        // Register JS
        JS.RegisterJS(this, JS.ManagedScript.EktronJS);
        JS.RegisterJS(this, JS.ManagedScript.EktronXmlJS);
        JS.RegisterJS(this, JS.ManagedScript.EktronModalJS);
        JS.RegisterJS(this, m_refSiteApi.AppPath + "PageBuilder/Wizards/js/ektron.pagebuilder.wizards.js", "EktronPageBuilderWizardsJS");
        JS.RegisterJS(this, m_refSiteApi.AppPath + "PageBuilder/Wizards/js/wizardResources.aspx", "EktronPageBuilderWizardResourcesJS");

        // register necessary CSS
        Css.RegisterCss(this, Css.ManagedStyleSheet.EktronModalCss);
        Css.RegisterCss(this, m_refSiteApi.AppPath + "PageBuilder/Wizards/css/ektron.pagebuilder.wizards.css", "EktronPageBuilderWizardsCSS");
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RegisterWorkareaCssLink();
        this.RegisterDialogCssLink();
        Ektron.Cms.API.JS.RegisterJS(this, "../ContentDesigner/ekxbrowser.js", "ekxbrowserJS");
        Ektron.Cms.API.JS.RegisterJS(this, "../ContentDesigner/ekutil.js", "ekutilJS");
        Ektron.Cms.API.JS.RegisterJS(this, "../ContentDesigner/RadWindow.js", "RadWindowJS");
        this.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitializeRadWindow",
            "InitializeRadWindow();  self.focus();", true);

        m_refMsg = m_refAPI.EkMsgRef;
        Utilities.ValidateUserLogin();
        titlePage.Text = m_refMsg.GetMessage("lbl imagetool edit title");
        if (!Page.IsPostBack) {
            // Information from the URL parameters
            if (null != Request.Params.Get("s"))
            {
                if (null != Session["ImageToolNewFile"])
                {
                    // save image clicked
                    // update the thumbnail for the image
                    Ektron.Cms.ImageTool.ImageTool imager = new Ektron.Cms.ImageTool.ImageTool();
                    string imagefilepath = (string) Session["ImageToolNewFile"];
                    string thumbfilepath = imagefilepath;
                    if (thumbfilepath.ToLower().EndsWith(".gif"))
                    {
                        thumbfilepath = thumbfilepath.Substring(0, thumbfilepath.LastIndexOf(".")) + ".png";
                    }
                    thumbfilepath = thumbfilepath.Substring(0, thumbfilepath.LastIndexOf("\\") + 1)
                        + "thumb_"
                        + thumbfilepath.Substring(thumbfilepath.LastIndexOf("\\") + 1);
                    /**** THIS IS NOW DONE in ImageScore.aspx.cs on CommitPersistentCommand
                    try
                    {
                        imager.Resize(125, -1, true, imagefilepath, thumbfilepath);
                    }
                    catch (IOException)
                    {
                        // the thumbnail service might be already updating the thumbnail
                        // so just ignore any I/O exceptions
                    }
                     */
                    // copy image to any load balance locations
                    Ektron.Cms.Library.EkLibrary refLib = m_refAPI.EkLibraryRef;
                    foreach (Microsoft.VisualBasic.Collection libpath in refLib.GetAllLBPaths("images"))
                    {
                        string relLBpath = (string) libpath["LoadBalancePath"];
                        string realLBpath = Server.MapPath(relLBpath);
                        string imgfilename = imagefilepath.Substring(imagefilepath.LastIndexOf("\\")+1);
                        string thumbnailfname = thumbfilepath.Substring(thumbfilepath.LastIndexOf("\\")+1);
                        try
                        {
                            File.Copy(imagefilepath, realLBpath + imgfilename);
                        }
                        catch (Exception) {}
                        try
                        {
                            File.Copy(thumbfilepath, realLBpath + thumbnailfname);
                        }
                        catch (Exception) { }
                    }
                    // clear out the session variable holding the new filename
                    Session["ImageToolNewFile"] = null;
                    Session["ImageToolNewFileUrl"] = null;
                    Session["ImageToolOldLibId"] = null;
                    Session["ImageToolOldLibContentId"] = null;
                    Session["ImageToolNewLibFileName"] = null;
                    Session["ImageToolLibFolderId"] = null;
                    Session["ImageToolAssetName"] = null;
                }
            }
            else if (null != Request.Params.Get("c"))
            {
                // cancel, so delete the new image file
                // then delete the session variable holding the new filename
                if (null != Session["ImageToolNewFile"])
                {
                    // get rid of library entry for image
                    Ektron.Cms.ContentAPI refContApi = getContentAPI();
                    refContApi.DeleteLibraryItemForImageTool((string)Session["ImageToolNewFileUrl"]);
                    if ((Session["ImageToolAssetName"] != null) && !((string)Session["ImageToolAssetName"]).StartsWith("thumb_"))
                    {
                        refContApi.DeleteAssetForImageTool((string)Session["ImageToolAssetName"]);
                    }
                    // get rid of image file
                    string imagefilepath = (string)Session["ImageToolNewFile"];
                    if (File.Exists(imagefilepath))
                    {
                        try
                        {
                            File.Delete(imagefilepath);
                        }
                        catch (IOException) { }
                    }
                    string thumbfilepath = imagefilepath;
                    if (thumbfilepath.ToLower().EndsWith(".gif"))
                    {
                        thumbfilepath = thumbfilepath.Substring(0, thumbfilepath.LastIndexOf(".")) + ".png";
                    }
                    thumbfilepath = thumbfilepath.Substring(0, thumbfilepath.LastIndexOf("\\") + 1)
                        + "thumb_"
                        + thumbfilepath.Substring(thumbfilepath.LastIndexOf("\\") + 1);
                    // and the thumbnail
                    if (File.Exists(thumbfilepath))
                    {
                        try
                        {
                            File.Delete(thumbfilepath);
                        }
                        catch (IOException) { }
                    }
                }
                Session["ImageToolNewFile"] = null;
                Session["ImageToolNewFileUrl"] = null;
                Session["ImageToolOldLibId"] = null;
                Session["ImageToolOldLibContentId"] = null;
                Session["ImageToolNewLibFileName"] = null;
                Session["ImageToolLibFolderId"] = null;
                Session["ImageToolAssetName"] = null;
            }
            else if (null != Request.Params.Get("i"))
            {
                string strValue = Page.Server.UrlDecode(Request.Params.Get("i")).Trim();
                if (!strValue.Contains("://"))
                {
                    // see if we're editing a thumbnailed image which comes in w/o a full URL
                    strValue = Request.Url.Scheme + "://" + Request.Url.Host +
                        ((((Request.Url.Scheme == "http") && (Request.Url.Port != 80)) ||
                        ((Request.Url.Scheme == "https") && (Request.Url.Port != 443))) ?
                        (":" + Request.Url.Port) : "")
                        + strValue;
                }
                if (strValue.Contains("://"))
                {
                    URL url = new URL(strValue);
                    URL myURL = new URL(Page.Request.Url.ToString());
                    strValue = url.Path;
                    if (strValue.StartsWith(":"))
                    {
                        // work around asp.net bug where url.path includes port# for path
                        strValue = strValue.Substring(strValue.IndexOf("/"));
                    }

                    // get info for old library item
                    string origImagePath = strValue;
                    bool fEditingThumbnail = false;
                    bool fIsAssetImage = false;
                    Ektron.Cms.ContentAPI refContApi = getContentAPI();
                    Ektron.Cms.LibraryData library_data = refContApi.GetLibraryItemByUrl(strValue);
                    if ((library_data == null) && strValue.Contains("thumb_"))
                    {
                        // this is a thumbnail so try to locate the image associated with it
                        // since we don't store the thumbnail path in the DB
                        origImagePath = strValue.Replace("thumb_", "");
                        library_data = refContApi.GetLibraryItemByUrl(origImagePath);
                        if (library_data == null)
                        {
                            // thumbnails are PNG files so see if the original was a JPEG or GIF
                            string[] imageexts = { ".jpg", ".gif" };
                            foreach (string ext in imageexts)
                            {
                                string origImageGuess = origImagePath.Replace(".png", ext);
                                library_data = refContApi.GetLibraryItemByUrl(origImageGuess);
                                if (library_data != null)
                                {
                                    origImagePath = origImageGuess;
                                    break;
                                }
                            }
                        }
                        fEditingThumbnail = true;
                    }
                    if (library_data == null)
                    {
                        panelMessage.Visible = true;
                        lblMessage.Text = m_refMsg.GetMessage("err imagetool unable to find image") + strValue;
                        imagetool.Visible = false;
                        return;
                    }
                    long folderid = library_data.ParentId;
                    if ((library_data.ParentId == 0) && (library_data.ContentId != 0))
                    {
                        // this is a DMS asset, so look up the folder it belongs in
                        folderid = refContApi.GetFolderIdForContentId(library_data.ContentId);
                        fIsAssetImage = true;
                    }
                    Ektron.Cms.PermissionData security_data = refContApi.LoadPermissions(folderid, "folder", Ektron.Cms.ContentAPI.PermissionResultType.Common);
                    Ektron.Cms.PermissionData usersecurity_data = refContApi.LoadPermissions(refContApi.UserId, "users", Ektron.Cms.ContentAPI.PermissionResultType.All);
                    if (!security_data.CanAddToImageLib && !usersecurity_data.IsAdmin)
                    {
                        panelMessage.Visible = true;
                        lblMessage.Text = m_refMsg.GetMessage("err imagetool no library permission");
                        imagetool.Visible = false;
                        return;
                    }

                    // generate new filename
                    if ((url.HostName == myURL.HostName) || (url.HostName.ToLower() == "localhost"))
                    {
                        string strFilePath = null;
                        try
                        {
                            strFilePath = Server.MapPath(origImagePath);
                        }
                        catch (Exception)
                        {
                            panelMessage.Visible = true;
                            lblMessage.Text = m_refMsg.GetMessage("err imagetool non site image");
                            imagetool.Visible = false;
                            return;
                        }
                        string strNewFilePath = strFilePath;
                        if (File.Exists(strFilePath))
                        {
                            FileInfo fileinfo = new FileInfo(strFilePath);
                            // name the file "<oldname>.N.<extension>"
                            string origfname = fileinfo.Name;
                            string fname = origfname;
                            string newfname = fname;
                            do
                            {
                                string[] fnamepieces = fname.Split(new char[] { '.' });
                                newfname = fname;
                                if (fnamepieces.Length > 2)
                                {
                                    // loop until we find one that doesn't exist
                                    string strCurVer = fnamepieces[fnamepieces.Length - 2];
                                    string strExt = fnamepieces[fnamepieces.Length - 1];
                                    int newVer = int.Parse(strCurVer) + 1;
                                    newfname = fname.Replace("." + strCurVer + "." + strExt, "." + newVer + "." + strExt);
                                }
                                else if (fnamepieces.Length == 2)
                                {
                                    newfname = fnamepieces[0] + ".1." + fnamepieces[1];
                                }
                                else
                                {
                                    // not sure what to do w/ filename w/ no extension???
                                }
                                strNewFilePath = strNewFilePath.Replace(fname, newfname);
                                fileinfo = new FileInfo(strNewFilePath);
                                if (fileinfo.Exists)
                                {
                                    fname = fileinfo.Name;
                                }
                            } while (fileinfo.Exists);
                            if (strFilePath != strNewFilePath)
                            {
                                File.Copy(strFilePath, strNewFilePath);
                                strValue = origImagePath.Replace(origfname, newfname);
                                // save new filename so we can clean it up when user clicks on "cancel" button
                                Session["ImageToolNewFile"] = strNewFilePath;
                                // save URL so we can delete it from the library
                                Session["ImageToolNewFileUrl"] = strValue;
                                // save asset filename if we it's an asset
                                Session["ImageToolAssetName"] = null;
                                if (fIsAssetImage)
                                {
                                    Session["ImageToolAssetName"] = newfname;
                                }

                                if (library_data != null)
                                {
                                    // save tags and metadata for original image
                                    Ektron.Cms.TagData[] oldtags = null;
                                    Ektron.Cms.Community.TagsAPI refTagsApi = new Ektron.Cms.Community.TagsAPI();
                                    Ektron.Cms.ContentMetaData[] oldmeta = null;
                                    if (library_data.Id > 0)
                                    {
                                        Session["ImageToolOldLibId"] = library_data.Id;
                                        Session["ImageToolOldLibContentId"] = library_data.ContentId;
                                        oldtags = refTagsApi.GetTagsForObject(library_data.Id,
                                            Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Library,
                                            refContApi.ContentLanguage);
                                        if (library_data.ContentId != 0) {
                                            Ektron.Cms.ContentData content_data = refContApi.GetContentById(library_data.ContentId,
                                                Ektron.Cms.ContentAPI.ContentResultType.Published);
                                            if (content_data != null)
                                            {
                                                oldmeta = content_data.MetaData;
                                            }
                                        } else {
                                            oldmeta = library_data.MetaData;
                                        }
                                    }
                                    // create new image to edit
                                    library_data.Id = 0;
                                    if (fEditingThumbnail)
                                    {
                                        origfname = new FileInfo(origImagePath).Name;
                                        library_data.FileName = library_data.FileName.Replace(origfname, newfname);
                                    }
                                    else
                                    {
                                        library_data.FileName = library_data.FileName.Replace(origfname, newfname);
                                    }
                                    library_data.ParentId = folderid;
                                    Session["ImageToolNewLibFileName"] = library_data.FileName;
                                    Session["ImageToolLibFolderId"] = library_data.ParentId;
                                    long newLibId = refContApi.AddLibraryItemForImageTool(ref library_data);
                                    if (fIsAssetImage && !newfname.StartsWith("thumb_"))
                                    {
                                        // only need to add this for assets, not thumbnail of assets
                                        refContApi.AddAssetForImageTool(origfname, newfname);
                                    }
                                    // add original tags/metadata to new image
                                    if (oldtags != null) {
                                        foreach (Ektron.Cms.TagData tag in oldtags)
                                        {
                                            refTagsApi.AddTagToObject(tag.Id, newLibId,
                                                  Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Library,
                                                  -1, refContApi.ContentLanguage);
                                        }
                                    }
                                    if (oldmeta != null)
                                    {
                                         refContApi.UpdateLibraryMetadataByID(newLibId, oldmeta);
                                    }
                                }

                                // can't show filenames or it'll be too long and the DMS filenames are ugly
                            //titlePage.Text = m_refMsg.GetMessage("lbl imagetool edit title") + ": " + origfname;
                            }
                        }
                        imagetool.Edit(strValue);
                    }
                    else
                    {
                        panelMessage.Visible = true;
                        lblMessage.Text = m_refMsg.GetMessage("err imagetool non site image");
                        imagetool.Visible = false;
                    }
                }
            }
        }
    }
Beispiel #4
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        Page.Response.ContentType = "text/xml";
        Page.Response.Clear();
        Page.Response.BufferOutput = true;

        string text = "";
        int pageNumber = 1;
        int totalPages = 0;
        int MaxResults = 0;
        int iLoop = 1;
        string strID = "";
        StringBuilder strFields = new StringBuilder();
        string strOnclick = "";
        long contentId = 0;
        long selectedId = -1;
        int languageID = m_commonApi.RequestInformationRef.ContentLanguage;
        m_refMsg = m_commonApi.EkMsgRef;

        Ektron.Cms.ContentAPI content_api = null;
        content_api = new Ektron.Cms.ContentAPI();
        if (content_api.GetCookieValue("LastValidLanguageID") != "" && Convert.ToInt32(content_api.GetCookieValue("LastValidLanguageID")) != -1)
        {
            languageID = Convert.ToInt32(content_api.GetCookieValue("LastValidLanguageID"));
        }

        text = Request.QueryString["text"];
        if (!string.IsNullOrEmpty(Request.QueryString["pnum"]) && Convert.ToInt32(Request.QueryString["pnum"]) > 0)
        {
            pageNumber = Convert.ToInt32(Request.QueryString["pnum"]);
        }

        if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
        {
            contentId = Convert.ToInt64(Request.QueryString["cid"]);
        }

        if (!string.IsNullOrEmpty(Request.QueryString["selectedid"]))
        {
            selectedId = Convert.ToInt64(Request.QueryString["selectedid"]);
        }

        Ektron.Cms.API.Search.SearchManager search = new Ektron.Cms.API.Search.SearchManager();
        SearchRequestData requestData = new SearchRequestData();
        requestData.SearchFor = Ektron.Cms.WebSearch.SearchDocumentType.all;
        requestData.SearchText = text;
        requestData.PageSize = 10;
        requestData.LanguageID = languageID;
        requestData.CurrentPage = pageNumber;
        int resultCount = 0;
        SearchResponseData[] result = search.Search(requestData, HttpContext.Current, ref resultCount);
        StringBuilder str = new StringBuilder();
        StringBuilder strRet = new StringBuilder();
        int tmpCount = 0;
        string strLink = "";
        string[] arLink = null;
        MaxResults = requestData.PageSize;
        if (resultCount != 0)
        {
            str.Append("<table width=\"100%\" class=\"ektronGrid\">");
            foreach (SearchResponseData data in result)
            {
                strLink = "";
                strID = (string)("ek_sel_cont" + iLoop);
                if (data.QuickLink.IndexOf("http://") > -1)
                {
                    strLink = (string)(data.QuickLink);
                    strLink = strLink.Substring(7);
                    strLink = "http://" + strLink.Replace("\'", "\\\'").Replace("//", "/");
                }
                if (strLink.ToLower().IndexOf("window.open") < 0)
                {
                    arLink = strLink.Split("?".ToCharArray());
                    if (arLink.Length > 1)
                    {
                        strLink = arLink[0];
                        arLink = arLink[1].Split("&amp;".ToCharArray());
                        foreach (string val in arLink)
                        {
                            if (val.IndexOf("terms=") == -1)
                            {
                                if (strLink == "")
                                {
                                    strLink = val;
                                }
                                else
                                {
                                    if (strLink.IndexOf("?") < 0)
                                    {
                                        strLink = strLink + "?" + val;
                                    }
                                    else
                                    {
                                        strLink = strLink + "&" + val;
                                    }
                                }
                            }
                        }
                    }
                }

                strOnclick = "SelectContent(\'" + strID + "\',\'" + strLink + "\')";
                str.Append("<tr><td valign=\"top\" style=\"width:1%;\" valign=\"top\">");
                str.Append("<input type=\"radio\" ");
                if (selectedId != -1 && selectedId == data.ContentID)
                {
                    str.Append(" checked=\"true\" ");
                }

                if (data.ContentID == contentId)
                {
                    str.Append(" disabled ");
                }

                str.Append("onclick=\"" + strOnclick + "\" id=\"");
                str.Append(strID);
                str.Append("\" name=\"ek_sel_cont\"/></td><td valign=\"top\">");
                str.Append("<span onclick=\"" + strOnclick + "\" class=\"title\">");
                str.Append(data.Title).Append("</span><br/>");
                str.Append("<span onclick=\"SelectContent(\'" + strID + "\',\'" + strLink + "\')\" class=\"summary\">");
                if (data.ContentType != 2 && data.ContentType != 4)
                {
                    str.Append(data.Summary.Replace("<p> </p>", "").Replace("<p>&nbsp;</p>", "").Replace("<p>&#160;</p>", ""));
                }

                str.Append("</span></td></tr>");
                strFields.Append(",").Append(strID);
                iLoop++;
            }
        }

        if (resultCount > 0 && MaxResults > 0)
        {
            if (resultCount % MaxResults == 0)
            {
                totalPages = resultCount / MaxResults;
            }
            else
            {
                tmpCount = System.Convert.ToInt32(resultCount / MaxResults);
                if (tmpCount * MaxResults < resultCount)
                {
                    totalPages = tmpCount + 1;
                }
                else
                {
                    totalPages = tmpCount;
                }
            }
        }

        str.Append("</table>");
        if (totalPages == 0)
        {
            strRet = new StringBuilder();
            strRet.Append("<content>");
            strRet.Append("<table style=\"width:100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            strRet.Append("<tr><td>" + m_refMsg.GetMessage("alt no related content") + "</td></tr>");
            strRet.Append("</table>");
            strRet.Append("</content>");
            strRet.Append("<totalPages>").Append(totalPages).Append("</totalPages>");
        }
        else
        {
            strRet.Append("<content>");
            strRet.Append("<div class=\"header\">" + m_refMsg.GetMessage("lbl total") + ": ").Append(resultCount).Append("<br/>");
            strRet.Append("" + m_refMsg.GetMessage("page lbl") + ": ").Append(pageNumber).Append(" " + m_refMsg.GetMessage("lbl of") + " ").Append(totalPages).Append("</div>");
            strRet.Append(str.ToString());
            strRet.Append("</content>");
            strRet.Append("<totalPages>").Append(totalPages).Append("</totalPages>");
        }

        Response.Write(strRet.ToString());
    }
Beispiel #5
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        Ektron.Cms.Content.EkContent objContentRef;
        objContentRef = m_refContentApi.EkContentRef;

        // register JS and CSS
        RegisterResources();
        jsStyleSheet.Text = (new StyleHelper()).GetClientScript();
        m_refMsg = (new Ektron.Cms.CommonApi()).EkMsgRef;
        if ((Convert.ToBoolean(m_refContentApi.RequestInformationRef.IsMembershipUser) || m_refContentApi.RequestInformationRef.UserId == 0 || !m_refContentApi.EkUserRef.IsAllowed(m_refContentApi.UserId, 0, "users", "IsAdmin", 0)) && !(objContentRef.IsARoleMember((long)Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SearchAdmin, m_refContentApi.UserId, false)))
        {
            Response.Redirect(m_refContentApi.ApplicationPath + "Login.aspx", true);
            return;
        }

        if (!IsSearchConfigured())
        {
            Utilities.ShowError(m_refMsg.GetMessage("msg search suggested results connection error"));
        }
        else
        {

            if (!string.IsNullOrEmpty(Request.QueryString["action"]))
            {
                strPageAction = Request.QueryString["action"].ToLower();
            }

            if (!string.IsNullOrEmpty(Request.QueryString["termID"]))
            {
                suggestedResultID = Request.QueryString["termID"];
            }

            jsSuggestedResultID.Text = suggestedResultID;
            jsPageAction.Text = strPageAction;
            jsDelResultSet.Text = m_refMsg.GetMessage("js confirm delete suggested result set");
            jsDelResult.Text = m_refMsg.GetMessage("js confirm delete suggested result");
            jsDelResultEdit.Text = m_refMsg.GetMessage("js confirm delete suggested result edit");
            //jsResultTerm.Text = m_refMsg.GetMessage("lbl suggested result term");
            //jsTypeOpt2.Text = m_refMsg.GetMessage("msg suggestedresults type option2");
            jsLinkReq.Text = m_refMsg.GetMessage("js link required");
            jsTitleReq.Text = m_refMsg.GetMessage("js title required");
            jsSummaryReq.Text = m_refMsg.GetMessage("js summary required");
            jsSizeExceeded.Text = m_refMsg.GetMessage("js summary size exceeded");
            jsTermReq.Text = m_refMsg.GetMessage("js term required");
            jsTermNoCommas.Text = m_refMsg.GetMessage("js terms no commas");
            jsTermsNoParenthesis.Text = m_refMsg.GetMessage("js terms no parenthesis");
            jsSynonymSetReq.Text = m_refMsg.GetMessage("js synonym set required");
            jsSugResultReq.Text = m_refMsg.GetMessage("js one or more suggested results required");
            try
            {
                switch (strPageAction)
                {
                    case "viewsuggestedresults":
                        // reference viewsuggestedresults.ascx
                        objViewSuggestedResults = (Workarea_controls_search_viewsuggestedresults)(LoadControl("../controls/search/viewsuggestedresults.ascx"));
                        objViewSuggestedResults.ID = "viewsuggestedresults";
                        DataHolder.Controls.Add(objViewSuggestedResults);
                        break;

                    case "addsuggestedresult":
                        // reference addsuggestedresults.ascx
                        objAdd = (Workarea_controls_search_addsuggestedresult)(LoadControl("../controls/search/addsuggestedresult.ascx"));
                        objAdd.ID = "addsuggestedresult";
                        DataHolder.Controls.Add(objAdd);
                        break;

                    case "viewsuggestedresult":
                        // reference viewsuggestedresults.ascx
                        objView = (Workarea_controls_search_viewsuggestedresult)(LoadControl("../controls/search/viewsuggestedresult.ascx"));
                        objAdd.ID = "viewsuggestedresult";
                        DataHolder.Controls.Add(objView);
                        break;

                    case "editsuggestedresult":
                        // reference addsuggestedresults.ascx
                        objAdd = (Workarea_controls_search_addsuggestedresult)(LoadControl("../controls/search/addsuggestedresult.ascx"));
                        objAdd.ID = "addsuggestedresult";
                        DataHolder.Controls.Add(objAdd);
                        break;

                    case "deletesuggestedresult":
                        // reference addsuggestedresults.ascx
                        objDelete = (Workarea_controls_search_deletesuggestedresults)(LoadControl("../controls/search/deletesuggestedresults.ascx"));
                        objDelete.ID = "deletesuggestedresult";
                        DataHolder.Controls.Add(objDelete);
                        break;
                }
            }
            catch (Exception ex)
            {
                Utilities.ShowError(ex.Message);
            }
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/javascript";
        // initialize additional variables for later use
        m_refMsg = m_refSiteApi.EkMsgRef;

        // instantiate contentAPI reference
        ContentAPI contentApi = new ContentAPI();

        // assign the resource text values as needed
        jsAddPage.Text = m_refMsg.GetMessage("lbl pagebuilder add page");
        jsAppPath.Text = contentApi.AppPath;
        jsBack.Text = m_refMsg.GetMessage("back");
        jsCancel.Text = m_refMsg.GetMessage("btn cancel");
        jsFinish.Text = m_refMsg.GetMessage("btn finish");
        jsNext.Text = m_refMsg.GetMessage("btn next");
        jsOk.Text = m_refMsg.GetMessage("lbl ok");
        jsSavePageAs.Text = m_refMsg.GetMessage("lbl pagebuilder save page");
        jsWizardsPath.Text = (contentApi.AppPath + "pagebuilder/wizards/");
        jsErrorPageTitle.Text = m_refMsg.GetMessage("lbl pagebuilder error page title");
        jsErrorSelectLayout.Text = m_refMsg.GetMessage("lbl pagebuilder error select layout");
        jsErrorUrlAlias.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias");
        jsErrorUrlAliasExists.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias exists");
        jsdropdownMustMatch.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias selection must match");
        jsinvalidExtension.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias invalid extension");
        jsselectExtension.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias select extension");
        jserrorMetadata.Text = m_refMsg.GetMessage("lbl pagebuilder error metadata");
        jserrorTaxonomy.Text = m_refMsg.GetMessage("lbl pagebuilder error taxonomy");
        jsloading.Text = m_refMsg.GetMessage("lbl sync loading");
        jsAddMaster.Text = m_refMsg.GetMessage("lbl Add Master Layout");
    }
Beispiel #7
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJS);
        Ektron.Cms.API.JS.RegisterJS(this, m_refContentApi.AppPath + "java/dateParser.js", "DateJS");

        m_refMsg = m_refContentApi.EkMsgRef;
        Save.ToolTip = Save.Text = m_refMsg.GetMessage("generic save");
        ToolBar();

        if (!string.IsNullOrEmpty(Request.QueryString["widgetid"]))
        {
            if (!long.TryParse(Request.QueryString["widgetid"], out m_widgetID))
            {
                ShowError("Could not find that widget");
                return;
            }
        }

        if (m_widgetID > -1)
        {
            if (!m_refWidgetModel.FindByID(m_widgetID, out info))
            {
                ShowError("Could not find that widget");
                return;
            }
        }

        if (info != null)
        {
            lblID.Text = info.ID.ToString();
            lblID.ToolTip = lblID.Text;
            lblFilename.Text = info.ControlURL;
            lblFilename.ToolTip = lblFilename.Text;
            txtTitle.Text = info.Title;
            txtTitle.ToolTip = txtTitle.Text;
            txtLabel.Text = info.ButtonText;
            txtLabel.ToolTip = txtLabel.Text;

            //get properties marked as global settings and fill in table
            LoadWidgetGlobalProps();
            SetupPropertyEditor();

            viewset.SetActiveView(viewSettings);

            if (Page.IsPostBack)
            {
                SaveProperties(null, null);
            }
        }
        else
        {
            ShowError("Unknown error");
            return;
        }
    }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_refMsg = m_contentApi.EkMsgRef;

        if (FolderID > -1)
        {
            if (folderData != null)
            {
                if (folderData.FolderTaxonomy.Length == 0)
                {
                    noTaxonomies.Text = m_refMsg.GetMessage("generic no taxonomy");
                    noTaxonomies.ToolTip = noTaxonomies.Text;
                }

                taxRequired.InnerText = folderData.CategoryRequired.ToString().ToLower();

                taxonomies.DataSource = folderData.FolderTaxonomy;
                taxonomies.DataBind();
            }
        }

        // Register JS
        JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS);
        JS.RegisterJSInclude(this, JS.ManagedScript.EktronTreeviewJS);
        JS.RegisterJSInclude(this, m_contentApi.AppPath + "PageBuilder/taxonomytree.js", "TaxTreeJS");

        string inittree = String.Format("Ektron.TaxonomyTree.init(\"{0}\", \"{1}\");", m_contentApi.AppPath, txtselectedTaxonomyNodes.ClientID);
        try
        {
            JS.RegisterJSBlock(this, inittree, txtselectedTaxonomyNodes.ClientID + "TaxTreeInit");
        }
        catch
        {
            //we're apparently in a full postback which doesn't care for registerjsblock
            script.Text = "<script type=\"text/javascript\" defer=\"defer\"> window.setTimeout(function(){" + inittree + "}, 750); </script>";
            script.Visible = true;
        }

        // Register CSS
        Css.RegisterCss(this, Css.ManagedStyleSheet.EktronTreeviewCss);
    }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m_refMsg = m_refSiteApi.EkMsgRef;
            ContentAPI capi = new ContentAPI();
            if (_fid > -1)
            {
                FolderData fd = capi.GetFolderById(_fid, true, false);
                if (fd != null)
                {
                    if (fd.FolderTaxonomy.Length == 0)
                    {
                        noTaxonomies.Text = m_refMsg.GetMessage("generic no taxonomy");
                        noTaxonomies.ToolTip = m_refMsg.GetMessage("generic no taxonomy");
                    }

                    taxRequired.InnerText = fd.CategoryRequired.ToString().ToLower();

                    if (!IsPostBack)
                    {
                        taxonomies.DataSource = fd.FolderTaxonomy;
                        taxonomies.DataBind();

                        if (fd.FolderTaxonomy.Length > 0 && defaultTaxID > -1)
                        {
                            //output path to selected taxonomy
                            TaxonomyRequest taxrequest = new TaxonomyRequest();
                            taxrequest.IncludeItems = false;
                            taxrequest.Page = Page;
                            taxrequest.TaxonomyLanguage = capi.RequestInformationRef.ContentLanguage;
                            taxrequest.TaxonomyId = defaultTaxID;
                            taxrequest.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content;
                            TaxonomyData td = capi.EkContentRef.LoadTaxonomy(ref taxrequest);
                            if (td != null)
                            {
                                txtselectedTaxonomyNodes.Text = td.TaxonomyPath;
                            }
                        }
                    }
                }
            }
            else
            {
                if (!IsPostBack)
                {
                    Ektron.Cms.API.Content.Taxonomy tax = new Ektron.Cms.API.Content.Taxonomy();
                    TaxonomyRequest tr = new TaxonomyRequest();
                    tr.IncludeItems = false;
                    tr.Depth = 1;
                    tr.Page = Page;
                    tr.TaxonomyId = 0;
                    tr.TaxonomyLanguage = capi.RequestInformationRef.ContentLanguage;
                    tr.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content;
                    tr.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Content;
                    TaxonomyBaseData[] td = capi.EkContentRef.ReadAllSubCategories(tr);
                    taxonomies.DataSource = td;
                    taxonomies.DataBind();
                }
            }

            // Register JS
            JS.RegisterJS(this, JS.ManagedScript.EktronJS);
            JS.RegisterJS(this, JS.ManagedScript.EktronTreeviewJS);

            // Register CSS
            Css.RegisterCss(this, Css.ManagedStyleSheet.EktronTreeviewCss);
        }
Beispiel #10
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        Ektron.Cms.Content.EkContent objContentRef;
            objContentRef = m_refContentApi.EkContentRef;
            RegisterResources();
            styleSheetJs.Text = (new StyleHelper()).GetClientScript();
            m_refMsg = (new CommonApi()).EkMsgRef;

            // initialize JS text strings
            jsConfirmDeleteSet.Text = m_refMsg.GetMessage("js: confirm delete synonym set");
            jsConfirmFollowDupe.Text = m_refMsg.GetMessage("js confirm follow dupe");
            jsMinTwoTerms.Text = m_refMsg.GetMessage("js synonym min two terms");
            jsTermsNoCommas.Text = m_refMsg.GetMessage("js synonym terms no commas");
            jsTermNoParenthesis.Text = m_refMsg.GetMessage("js synonym terms no parenthesis");
            jsTermsNoLessGreater.Text = m_refMsg.GetMessage("js synonym terms no less than or greater than");

            if ((Convert.ToBoolean(m_refContentApi.RequestInformationRef.IsMembershipUser) || m_refContentApi.RequestInformationRef.UserId == 0 || ! m_refContentApi.EkUserRef.IsAllowed(m_refContentApi.UserId, 0, "users", "IsAdmin", 0)) && !(objContentRef.IsARoleMember((long)Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SearchAdmin, m_refContentApi.UserId, false)))
            {
                Response.Redirect(m_refContentApi.ApplicationPath + "Login.aspx", true);
                return;
            }

            if (!IsSearchConfigured())
            {
                Utilities.ShowError(m_refMsg.GetMessage("msg search synonyms connection error"));
            }
            else
            {

                if (!string.IsNullOrEmpty(Request.QueryString["action"]))
                {
                    strPageAction = Request.QueryString["action"].ToLower();
                    jsPageAction.Text = strPageAction;
                }

                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    synonymID = new Guid(Request.QueryString["id"]);
                    jsSynonymId.Text = synonymID.ToString();
                }

                try
                {
                    switch (strPageAction)
                    {
                        case "viewsynonyms":
                            // reference viewsynonyms.ascx
                            objViewSets = (viewsynonyms)(LoadControl("../controls/search/viewsynonyms.ascx"));
                            objViewSets.ID = "viewsynonyms";
                            DataHolder.Controls.Add(objViewSets);
                            break;

                        case "viewsynonym":
                            // reference viewsynonym.ascx
                            objView = (viewsynonym)(LoadControl("../controls/search/viewsynonym.ascx"));
                            objView.ID = "viewsynonym";
                            DataHolder.Controls.Add(objView);
                            break;

                        case "addsynonym":
                            // reference addsynonym.ascx
                            objAdd = (addsynonym)(LoadControl("../controls/search/addsynonym.ascx"));
                            objAdd.ID = "addsynonym";
                            DataHolder.Controls.Add(objAdd);
                            break;

                        case "deletesynonym":
                            // delete the Synonym Set specified and display the remaining Synonym Sets
                            objDelete = (Workarea_search_deletesynonym)(LoadControl("../controls/search/deletesynonym.ascx"));
                            objDelete.ID = "deletesynonym";
                            DataHolder.Controls.Add(objDelete);
                            break;

                        case "editsynonym":
                            // reference addsynonym.ascx
                            objAdd = (addsynonym)(LoadControl("../controls/search/addsynonym.ascx"));
                            objAdd.ID = "addsynonym";
                            DataHolder.Controls.Add(objAdd);
                            break;
                    }
                }
                catch (Exception ex)
                {
                    Utilities.ShowError(ex.Message);
                }
            }
    }