Example #1
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        jsStyleSheet.Text = (new StyleHelper()).GetClientScript();
        m_refMsg = (new CommonApi()).EkMsgRef;
        if ((m_refContentApi.EkContentRef).IsAllowed(0, 0, "users", "IsLoggedIn", m_refContentApi.UserId) == false)
        {
            Response.Redirect("login.aspx?fromLnkPg=1", false);
            return;
        }
        if (m_refContentApi.RequestInformationRef.IsMembershipUser > 0 || m_refContentApi.RequestInformationRef.UserId == 0)
        {
            Response.Redirect("reterror.aspx?info=Please login as cms user", false);
            return;
        }
        if (!(Request.QueryString["LangType"] == null))
        {
            if (Request.QueryString["LangType"] != "")
            {
                ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                m_refApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
            }
            else
            {
                if (m_refApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(m_refApi.GetCookieValue("LastValidLanguageID"));
                }
            }
        }
        else
        {
            if (m_refApi.GetCookieValue("LastValidLanguageID") != "")
            {
                ContentLanguage = Convert.ToInt32(m_refApi.GetCookieValue("LastValidLanguageID"));
            }
        }

        lib_setting_data = m_refContentApi.GetLibrarySettings(0); //Used in the scripting layer

        SetServerJSVariables();
        RegisterResources();

        Ektron.Cms.Commerce.IPasswordValidation pv = ObjectFactory.GetPasswordValidation();
        string validationString = (string)(pv.GetRegexForMember().Replace("\"", "\\\"").Replace("\\t", "\\\\t"));

        passwordValidationString.Text = validationString;

        MakeEmailArea.Text = (new EmailHelper()).MakeEmailArea();
        if (!String.IsNullOrEmpty(Request.QueryString["reloadtrees"]))
        {
            CloseScriptJS.Text = ClientCloseScriptJS();
        }
        jsADIntegration.Text = "false";
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);
        if (setting_data.ADIntegration)
        {
            jsADIntegration.Text = "true";
        }
        SitePath = m_refSiteApi.SitePath;
        jsSitePath.Text = SitePath;
        if (m_strPageAction == "viewallusers")
        {
            m_viewusers = (viewusers)(LoadControl("controls/user/viewusers.ascx"));
            m_viewusers.ID = "user";
            jsUniqueId.Text = "user_";
            DataHolder.Controls.Add(m_viewusers);
        }
        else if (m_strPageAction == "addusertogroup")
        {
            m_editgroups = (editgroups)(LoadControl("controls/user/editgroups.ascx"));
            m_editgroups.ID = "user";
            jsUniqueId.Text = "user_";
            DataHolder.Controls.Add(m_editgroups);
        }
        else if (m_strPageAction == "viewallgroups")
        {
            m_viewgroups = (viewgroups)(LoadControl("controls/user/viewgroups.ascx"));
            m_viewgroups.ID = "user";
            jsUniqueId.Text = "user_";
            DataHolder.Controls.Add(m_viewgroups);
        }
    }
Example #2
0
    private string ClientScript_IsExtensionValid(LibraryConfigData lib_setting_data)
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        result.Append("function IsExtensionValid(libType, filename) {" + "\r\n");

        result.Append("	if (libType == \"images\") {" + "\r\n");
        if (!(lib_setting_data == null))
        {
            result.Append("		var ExtensionList = \"" + lib_setting_data.ImageExtensions + "\";" + "\r\n");
        }
        else
        {
            result.Append("		var ExtensionList = \"\";" + "\r\n");
        }
        result.Append("	}" + "\r\n");
        result.Append("	else if (libType == \"files\") {" + "\r\n");
        if (!(lib_setting_data == null))
        {
            result.Append("		var ExtensionList = \"" + lib_setting_data.FileExtensions + "\";" + "\r\n");
        }
        else
        {
            result.Append("		var ExtensionList = \"\";" + "\r\n");
        }
        result.Append("	}" + "\r\n");
        result.Append("	else if (libType == \"all\") {" + "\r\n");
        if (!(lib_setting_data == null))
        {
            result.Append("		var ExtensionList = \"" + lib_setting_data.ImageExtensions + "," + lib_setting_data.FileExtensions + "\";" + "\r\n");
        }
        else
        {
            result.Append("		var ExtensionList = \";" + "\r\n");
        }
        result.Append("		alert(ExtensionList);" + "\r\n");
        result.Append("	}" + "\r\n");
        result.Append("	if (ExtensionList.length > 0) {" + "\r\n");
        result.Append("		var ExtensionArray = ExtensionList.split(\",\");" + "\r\n");
        result.Append("		var FileExtension = filename.split(\".\");" + "\r\n");
        result.Append("		for (var i = 0; i < ExtensionArray.length; i++) {" + "\r\n");
        result.Append("			if (FileExtension[FileExtension.length - 1].toLowerCase() == Trim(ExtensionArray[i].toLowerCase())) {" + "\r\n");
        result.Append("				return true;" + "\r\n");
        result.Append("			}" + "\r\n");
        result.Append("		}" + "\r\n");
        result.Append("		return false;" + "\r\n");
        result.Append("	}" + "\r\n");
        result.Append("}" + "\r\n");
        return (result.ToString());
    }
Example #3
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        try
        {
            if (!Utilities.ValidateUserLogin())
            {
                return;
            }
            if (m_refContentApi.RequestInformationRef.UserId == 0)
            {
                Response.Redirect((string)("reterror.aspx?info=" + m_refMsg.GetMessage("msg login cms user")), false);
                return;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["LangType"]))
            {
                ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
            }
            else
            {
                if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = int.Parse(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                }
            }
            contLangID = ContentLanguage.ToString();
            if (!string.IsNullOrEmpty(Request.QueryString["caller"]))
            {
                caller = Request.QueryString["caller"];
            }
            m_refContentApi.ContentLanguage = ContentLanguage;
            if (!(Request.QueryString["action"] == null))
            {
                m_strPageAction = AntiXss.UrlEncode(Request.QueryString["action"]);
                if (m_strPageAction == "showLibdlg")
                {
                    hdnSelectedTab.Value = "1";
                }
            }
            ltrAction.Text = m_strPageAction;
            if (!(Request.QueryString["folderid"] == null))
            {
                if (Request.QueryString["folderid"] != "")
                {
                    m_intFolderId = Convert.ToInt64(Request.QueryString["folderid"]);
                }
            }

            folder_data = m_refContentApi.GetFolderById(m_intFolderId);
            folderType = (EkEnumeration.FolderType)folder_data.FolderType;

            sEditor = Request.QueryString["EditorName"];
            if (!String.IsNullOrEmpty(Request.QueryString["selected"]))
            {
                sLinkText = Request.QueryString["selected"];
            }
            if (!(Request.QueryString["type"] == null))
            {
                m_strLibType = Request.QueryString["type"];
            }

            if (!(Request.QueryString["source"] == null))
            {
                m_strSource = EkFunctions.HtmlEncode(Request.QueryString["source"]);
            }
            if (Request.QueryString["showthumb"] != null)
            {
                if (Request.QueryString["showthumb"] == "false")
                {
                    showThumbnail = false;
                }
            }
            if (Request.Browser.Type.IndexOf("IE") != -1)
            {
                IsBrowserIE = true;
                if (Request.Browser.MajorVersion >= 6)
                {
                    IsBrowserIE6Plus = true;
                }
            }

            if (Request.Browser.Platform.IndexOf("Win") == -1)
            {
                IsMac = true;
            }

            StyleSheetJS = m_refStyle.GetClientScript();
            ctrlFirstPage.Text = "[" + m_refMsg.GetMessage("lbl first page") + "]";
            ctrlPreviousPage.Text = "[" + m_refMsg.GetMessage("lbl previous page") + "]";
            ctrlNextPage.Text = "[" + m_refMsg.GetMessage("lbl next page") + "]";
            ctrlLastPage.Text = "[" + m_refMsg.GetMessage("lbl last page") + "]";
            // the following literal are defined in the include javascript file, mediaupldr_common
            jsEditorClosed.Text = m_refMsg.GetMessage("js: alert editor closed");
            jsScope.Text = Request.QueryString["scope"];
            jsEditorName.Text = Request.QueryString["EditorName"];
            jsDEntrylink.Text = Request.QueryString["dentrylink"];

            AppImgPath = m_refContentApi.AppImgPath;
            AppName = m_refContentApi.AppName;
            EnableMultilingual = m_refContentApi.EnableMultilingual;
            SitePath = m_refContentApi.SitePath;
            lib_setting_data = m_refContentApi.GetLibrarySettings(m_intFolderId);
            Page.Title = AppName + " " + "Collections";
            IsExtensionValid.Text = ClientScript_IsExtensionValid(lib_setting_data);
            if (m_strSource == "edit" || m_strSource == "libinsert" || m_strSource == "mediainsert")
            {
                body.Attributes.Add("class", "library");
            }
            else
            {
                body.Attributes.Add("class", "UiMain");
            }
            frm_folder_id.Value = Convert.ToString(m_intFolderId);
            frm_object_type.Value = Request.QueryString["ObjectType"];

            CustFieldsContentLit.Text = "";
            CustFieldsLibraryLit.Text = "";
            HiddenData.Text = "";

            //If coming to search first time, show 1st tab -
            //unless coming first time from mediainsert.aspx, only show the 2nd tab in that case.
            if (Page.IsPostBack == false && m_strSource != "mediainsert" && m_strSource != "edit")
            {
                //Make the first tab selected
                hmenuSelected.Value = "0";
                uxSearchTabs.SetActiveTab(uxTabBasic);
                //mvSearch.SetActiveView(vwSearchPublished);
                Display_ShowDlg_ToolBar();
            }

            //If coming from MediaInsert.aspx (inserting library items while adding/editing content, show only the second tab
            if (Page.IsPostBack == false && (m_strSource == "edit" || m_strSource == "mediainsert"))
            {
                hmenuSelected.Value = "1";
                //mvSearch.SetActiveView(vwSearchAdvanced);
                uxSearchTabs.SetActiveTab(uxTabAdvanced);
                Display_ShowLibdlg_ToolBar();
            }
            else if (Page.IsPostBack == true && (m_strSource == "edit" || m_strSource == "mediainsert"))
            {
                hdnSelectedTab.Value = "1";
            }

            object obj = HttpContext.Current.Request.Form["__EVENTTARGET"];
            if (obj != null && (obj.ToString().ToLower() == "uxsearchtabs$uxtabbasic" || obj.ToString().ToLower() == "uxsearchtabs$uxtabadvanced"))
            {
                isPostBackData = true;
            }

            if (websearch1 != null)
            {
                websearch1.Language = ContentLanguage;
                websearch1.FolderID = m_intFolderId;
                websearch1.IsInWorkArea = true;
            }

            if (Page.IsCallback)
            {
                return;
            }

            switch (m_strPageAction)
            {
                case "showdlg":
                    Display_ShowDlg();
                    SearchAssetDispayRequest sadReq = new SearchAssetDispayRequest();
                    sadReq.StartingFolder = "/";
                    sadReq.Recursive = true;
                    sadReq.TargetPage = "isearch.asp?Action=searchallassetsdisplay";
                    sadReq.ButtonText = m_refMsg.GetMessage("res_isrch_btn");
                    sadReq.FontFace = "Verdana";
                    sadReq.FontColor = "#808080";
                    sadReq.FontSize = "2";
                    sadReq.DynamicIncludeAssetTypes = true;
                    sadReq.DynamicIncludeCmsTypes = true;
                    sadReq.EnableShowLibrary = false; // remove library search from workareas-content-search.
                    sadReq.EnableBasicSearchLink = false; // disable the basic link.
                    sadReq.SearchHeaderText = m_refMsg.GetMessage("lbl srch text");
                    CustFieldsContentLit.Text = CustomFields.ecmSearchAllAssets(sadReq).ToString();
                    break;
                case "showLibdlg":
                    Display_ShowLibdlg();
                    CustFieldsLibraryLit.Text = CustomFields.WriteLibrarySearchExtended(m_intFolderId).ToString();
                    break;
                case "dofindcontent":
                    TR_showLibdlg.Visible = false;
                    TR_showdlg.Visible = false;
                    PostBack_DoFindContent();
                    break;
                case "dofindlibrary": //This action is routed from form details page
                    TR_showLibdlg.Visible = false;
                    TR_showdlg.Visible = false;
                    PostBack_DoFindLibrary();
                    break;
            }
            //End If
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().IndexOf("service is not running") != -1)
            {
                Utilities.ShowError("Error: Index service is not running.  You cannot search on Documents.  Restart the service or perform only on HTML content search");
            }
            else
            {
                Utilities.ShowError(ex.Message);
            }
        }
    }
Example #4
0
    public void ReceiveSubmittedFiles()
    {
        string errorMessage = "";
            long errorValue = 0;
            long sizeFile;
            string clientFileName = "";
            string clientFileExtension = "";
            string uploadedFilePhysPath = "";
            string altTitleFile = "";
            string typeFile = "";
            long idCmsFolder = 0;
            string[] fileExtnList;
            int i = 0;
            string uploadUrlPath = "";
            string uploadPhysicalPath = "";
            string strTmpServerInfo = "";
            string typeInCmsLib = "";
            Ektron.Cms.Library.EkLibrary libraryCmsObj;
            bool ret = false;
            string metaDataList = "";
            Collection cMetaColl = new Collection();
            string strName = "";
            int lLoop;
            int lInnerLoop;
            string teaserStoreForFile = "";
            string[] teaserListByFile;
            string teaserForFile;
            string teaserFileNormalized;
            string tempTeaser = "";
            bool thisTeaser;
            string strJustFileName = "";
            string clientFilePath;
            bool isUploadOK;

            typeFile = Request.Form["file_type"].ToString();
            sizeFile = Convert.ToInt64(Request.Form["file_size"]);
            altTitleFile = Request.Form["file_title"].ToString();

            clientFilePath = Request.Files["uploadfilephoto"].FileName.ToString();
            clientFileName = SimplifyFileName(Path.GetFileName(clientFilePath));

            // Non-standard (CMS specific) values.
            idCmsFolder = Convert.ToInt64(Request.Form["folder_id"]);

            //get the metadata, not critical field so do not error out if it does not exist
            metaDataList = Request.Form["custom_field_meta"];

            //get the teaser, not critical field so do not error out if it does not exist
            teaserStoreForFile = Request.Form["custom_field_teaser"];
            if (teaserStoreForFile == null)
            {
                teaserStoreForFile = "";
            }
            else
            {
                teaserStoreForFile = teaserStoreForFile.Replace("<p> </p>" + "\r\n", "<p>&#160;</p>");
            }

            thisTeaser = false;
            teaserListByFile = teaserStoreForFile.Split("|-|".ToCharArray()[0]);
            for (lLoop = 0; lLoop <= (teaserListByFile.Length - 1); lLoop++)
            {
                teaserForFile = teaserListByFile[lLoop];
                if (thisTeaser == true)
                {
                    tempTeaser = teaserListByFile[lLoop];
                    break;
                }
                teaserFileNormalized = teaserForFile.Replace(" ", "_");
                if (teaserFileNormalized == clientFileName)
                {
                    thisTeaser = true;
                }
            }

            teaserStoreForFile = tempTeaser;

            //get the extension from the filename
            clientFileExtension = (string) (Path.GetExtension(clientFileName).ToLower().TrimStart('.'.ToString().ToCharArray()));

            //get the library settings- extensions and image paths
            settingsCmsLibrary = m_refContentApi.GetLibrarySettings(idCmsFolder);

            //figure out the fileType
            typeFile = "none";

            //loop through the image extensions
            fileExtnList = settingsCmsLibrary.ImageExtensions.Split(new char[] { ',' });
            for (i = 0; i <= fileExtnList.Length - 1; i++)
            {
                if (clientFileExtension == fileExtnList[i].ToLower().Trim())
                {
                    typeFile = "images";
                    //needed to get correct lb paths
                    typeInCmsLib = "images";
                    //get correct path- cannot have a slash at the end
                    uploadUrlPath = MakeUploadPath((string) settingsCmsLibrary.ImageDirectory);
                    break;
                }
            }

            //if not an image, loop through the file extensions
            if (typeFile == "none")
            {
                fileExtnList = settingsCmsLibrary.FileExtensions.Split(new char[] { ',' });
                for (i = 0; i <= fileExtnList.Length - 1; i++)
                {
                    if (clientFileExtension == fileExtnList[i].ToLower().Trim())
                    {
                        typeFile = "files";
                        //needed to get correct lb paths
                        typeInCmsLib = "files";
                        //get correct path- cannot have a slash at the end
                        uploadUrlPath = MakeUploadPath((string) settingsCmsLibrary.FileDirectory);
                        break;
                    }
                }
            }

            uploadPhysicalPath = Server.MapPath(uploadUrlPath);

            PermissionData cPerms;

            //if the file is one of the allowed fileTypes, check permissions and continue
            if (typeFile != "none")
            {
                //check the permissions first
                cPerms = m_refContentApi.LoadPermissions(idCmsFolder, "folder",0);
                //if the uploader has the correct permission, upload the file
                if (((typeFile == "images") && (cPerms.CanAddToImageLib)) || ((typeFile == "files") && (cPerms.CanAddToFileLib)))
                {
                    //upload the file making it unique if there is already one there
                    isUploadOK = false;
                    uploadedFilePhysPath = SaveFileToPath(uploadPhysicalPath, clientFileName, false);
                    if (uploadedFilePhysPath.Length > 0)
                    {
                        strJustFileName = Path.GetFileName(uploadedFilePhysPath);
                        if ("images" == typeFile)
                        {
                            if (MakeStandardUploadThumbnail(uploadedFilePhysPath).Length == 0)
                            {
                                errorValue = 4;
                                errorMessage = "The server was not able to produce a thumbnail for the file \'" + strJustFileName + "\'\'.\\n\\nThe user may not have write permission to the \'" + uploadUrlPath + "\' folder on the server or there may not be enough resources on the server to produce a thumbnail.\\n\\nPlease see your site administrator to resolve the issue.";
                            }
                        }
                    }
                    else
                    {
                        errorValue = 3;
                        errorMessage = "Error performing the upload onto the server system.\\n\\nThe user may not have write permission to the \'" + uploadUrlPath + "\' folder on the server.\\n\\nPlease see your administrator to modify the server security to allow uploads at this location.";
                    }

                    if (0 == errorValue)
                    {
                        //if the main file uploaded fine, upload to all the load balance folders. Get the extra load balance paths
                        load_balance_data = m_refContentApi.GetAllLoadBalancePathsExtn(idCmsFolder, typeInCmsLib);

                        //if there are load balance paths
                        if (!(load_balance_data == null))
                        {
                            string pathPhysLoadBalanceUpload = "";

                            //loop through each of the paths, uploading the file to those locations
                            for (i = 0; i <= load_balance_data.Length - 1; i++) //Each lbObj In extraPaths
                            {
                                isUploadOK = false;
                                pathPhysLoadBalanceUpload = Server.MapPath(MakeUploadPath((string) (load_balance_data[i].Path)));
                                if (SaveFileToPath(pathPhysLoadBalanceUpload, strJustFileName, true).Length > 0)
                                {
                                    if ("images" == typeFile)
                                    {
                                        isUploadOK = System.Convert.ToBoolean(MakeStandardUploadThumbnail(CatPath(pathPhysLoadBalanceUpload, strJustFileName, false)).Length > 0);
                                    }
                                    else
                                    {
                                        isUploadOK = true;
                                    }
                                }
                                if (false == isUploadOK)
                                {
                                    //If the load balance upload fails then notify the admin and keep going
                                    string eTmp = "An upload failure has occured in the load balancing.  Load balancing path = \'" + pathPhysLoadBalanceUpload + "\'.  Uploaded Filename  = \'" + CatPath(pathPhysLoadBalanceUpload, strJustFileName, false) + "\'.";
                                    ret = System.Convert.ToBoolean(m_refContentApi.EkContentRef.ErrStatusToAdminGroup(eTmp, "Load Balance Error Report"));
                                }
                            }
                        }

                        //create an object with appropriate info to send to assembly to insert into the database
                        Collection cLibrary = new Collection();
                        cLibrary.Add(idCmsFolder, "ParentID", null, null);
                        cLibrary.Add("", "LibraryID", null, null);
                        cLibrary.Add(typeFile, "LibraryType", null, null);
                        if (altTitleFile.Length >= 150)
                        {
                            cLibrary.Add(altTitleFile.Substring(0, 150), "LibraryTitle", null, null);
                        }
                        else
                        {
                            cLibrary.Add(altTitleFile, "LibraryTitle", null, null);
                        }
                        cLibrary.Add("", "ContentID", null, null);
                        cLibrary.Add(currentUserID, "UserID", null, null);
                        cLibrary.Add(CatPath(uploadUrlPath, strJustFileName, false), "LibraryFilename", null, null);
                        cLibrary.Add("makeunique", "TitleConflict", null, null);

                        cLibrary.Add(teaserStoreForFile, "ContentTeaser", null, null);

                        if (!(metaDataList == null))
                        {
                            bool isData = false;
                            bool metaThis = false;
                            int countMeta = 1;
                            string[] metaByFileList;
                            string strMetaByFile;
                            string[] metaItemList = new string[4];
                            string strMeta;
                            string[] metaListFromByFile;

                            metaByFileList = metaDataList.Split("|-|".ToCharArray()[0]);
                            for (lLoop = 0; lLoop <= (metaByFileList.Length - 1); lLoop++)
                            {
                                strMetaByFile = metaByFileList[lLoop];
                                if (metaThis == true)
                                {
                                    metaThis = false;
                                    metaListFromByFile = strMetaByFile.Split("@@ekt@@".ToCharArray()[0]);
                                    for (lInnerLoop = 0; lInnerLoop <= (metaListFromByFile.Length - 1); lInnerLoop++)
                                    {
                                        strMeta = metaListFromByFile[lInnerLoop];
                                        if (isData == true)
                                        {
                                            isData = false;
                                            metaItemList[1] = strName;
                                            metaItemList[2] = "0";
                                            metaItemList[3] = strMeta;
                                            cMetaColl.Add(metaItemList, countMeta.ToString(), null, null);
                                            metaItemList = new string[4];
                                            countMeta++;
                                        }
                                        else if (strMeta != "")
                                        {
                                            isData = true;
                                            strName = strMeta;
                                        }
                                    }
                                }
                                teaserFileNormalized = strMetaByFile.Replace(" ", "_");
                                if (teaserFileNormalized == clientFileName)
                                {
                                    metaThis = true;
                                }
                            }
                        }
                        cLibrary.Add(cMetaColl, "ContentMetadata", null, null);

                        libraryCmsObj = m_refContentApi.EkLibraryRef;
                        ret = System.Convert.ToBoolean(libraryCmsObj.AddLibraryItemv2_0(cLibrary,m_refContentApi.RequestInformationRef.CallerId));

                        if (true == System.Convert.ToBoolean(Request.ServerVariables["SERVER_PORT_SECURE"]))
                        {
                            strTmpServerInfo = "https://";
                        }
                        else
                        {
                            strTmpServerInfo = "http://";
                        }
                        strTmpServerInfo = strTmpServerInfo + Request.ServerVariables["SERVER_NAME"];
                        if (Request.ServerVariables["SERVER_PORT"] != "80")
                        {
                            strTmpServerInfo = strTmpServerInfo + ":" + Request.ServerVariables["SERVER_PORT"];
                        }

                    }

                }
                else
                {

                    errorValue = 1;
                    errorMessage = "User does not have CMS permeissions to place files into the selected folder.\\n\\nPlease see your site administrator for modifying the permissions to allow this operation.";
                    return;
                }
            }
            else
            {
                errorValue = 2;
                errorMessage = "Invalid extension for the file " + clientFileName + ".\\n\\nPlease select a valid file type or contact your administrator to add this type to the list of valid files allowed in the upload process.";
            }

            System.Text.StringBuilder rData = new System.Text.StringBuilder();
            rData.Append("<XML ID=EktronFileIO>" + "\r\n");
            rData.Append("<UPLOAD>" + "\r\n");
            rData.Append("<FILEINFO ID=\"5\" discard=\"False\">" + "\r\n");
            rData.Append("<FSRC>" + clientFilePath + "</FSRC>" + "\r\n");
            if (0 == errorValue)
            {
                rData.Append("<FURL>" + strTmpServerInfo + CatPath(uploadUrlPath, strJustFileName, false) + "</FURL>" + "\r\n");
            }
            else
            {
                rData.Append("<FURL></FURL>" + "\r\n");
            }
            rData.Append("<FID></FID>" + "\r\n");
            rData.Append("<FSIZE>" + System.Convert.ToInt32("&h" + sizeFile) + "</FSIZE>" + "\r\n");
            rData.Append("<DESC>" + altTitleFile + "</DESC>" + "\r\n");
            rData.Append("<THUMBURL></THUMBURL>" + "\r\n");
            rData.Append("<THUMBHREF></THUMBHREF>" + "\r\n");
            rData.Append("<FTYPE>" + typeFile + "</FTYPE>" + "\r\n");
            rData.Append("<DWIDTH>0</DWIDTH>" + "\r\n");
            rData.Append("<DHEIGHT>0</DHEIGHT>" + "\r\n");
            rData.Append("<DBORDER>0</DBORDER>" + "\r\n");
            rData.Append("<FRAGMENT></FRAGMENT>" + "\r\n");
            if (0 == errorValue)
            {
                rData.Append("<FERROR value=\"0\"></FERROR>" + "\r\n");
            }
            else
            {
                rData.Append("<FERROR value=\"" + errorValue.ToString() + "\">" + errorMessage + "</FERROR>" + "\r\n");
            }
            rData.Append("</FILEINFO>" + "\r\n");
            rData.Append("</UPLOAD>" + "\r\n");
            rData.Append("</XML>" + "\r\n");
            Response.Write(rData.ToString());
    }
Example #5
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
        {
            Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error"));
        }
        lib_settings_data = this.m_refContentApi.GetLibrarySettings(iboardid);
        if (!Page.IsPostBack)
        {
            CheckAccess();
            productType = productTypeManager.GetItem(m_iID);

            lblTitle.InnerText = m_refMsg.GetMessage("generic title label");
            lblaltTitle.InnerText = m_refMsg.GetMessage("alt text");
            lblFullSize.InnerText = m_refMsg.GetMessage("lbl full size");

            if (productType.DefaultThumbnails.Count > 0)
            {
                ltr_pixel.Text = "<br /><table><tr><td>" + m_refMsg.GetMessage("lbl thumbnail spec") + "</td></tr>";
                foreach (ThumbnailDefaultData thumbnail in productType.DefaultThumbnails)
                {
                    ltr_pixel.Text += "<tr><td>&nbsp;&nbsp;" + thumbnail.Width.ToString() + " x " + thumbnail.Height.ToString() + " px</td></tr>";
                }
                ltr_pixel.Text += "</table>";
            }
            btnUpload.Attributes.Add("onclick", " return checkForEmptyTitleAndAlt(); return IsExtensionValid(); return checkntoggle(document.getElementById(\'dvHoldMessage\'),document.getElementById(\'dvErrorMessage\'));");
            btnUpload.Text = m_refMsg.GetMessage("upload txt");
        }
        GenerateJS();
    }
Example #6
0
        protected void Page_Init(object sender, System.EventArgs e)
        {
            _MessageHelper = _ContentApi.EkMsgRef;
                _ProductType = new ProductType(_ContentApi.RequestInformationRef);
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
                Response.Expires = -1;

                if (! Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
                {
                    Utilities.ShowError(_ContentApi.EkMsgRef.GetMessage("feature locked error"));
                }

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

                lib_settings_data = this._ContentApi.GetLibrarySettings(0);

                SetLocalizedStrings();

                btnUpload.Attributes.Add("onclick", "return checkForEmptyTitleAndAlt(); return checkntoggle(document.getElementById(\'dvHoldMessage\'),document.getElementById(\'dvErrorMessage\'));");
                btnUpload.Text = this.GetMessage("upload txt");

                _ProductTypeData = _ProductType.GetItem(_Id);
        }
Example #7
0
 protected void Page_Init(object sender, System.EventArgs e)
 {
     _MessageHelper = _ContentApi.EkMsgRef;
         _ProductType = new ProductType(_ContentApi.RequestInformationRef);
         _LibraryConfigData = this._ContentApi.GetLibrarySettings(0);
 }
Example #8
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        try
            {
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
                Response.Expires = -1;
                m_refMsg = m_refContentApi.EkMsgRef;
                RegisterResources();
                IsMembershipUser = System.Convert.ToBoolean(m_refContentApi.RequestInformationRef.IsMembershipUser == 1);

                m_refSiteApi = new SiteAPI();
                SitePath = m_refContentApi.SitePath;
                if (Request.QueryString["selected"]!= null && Request.QueryString["selected"] != "")
                {
                    sLinkText = Request.QueryString["selected"];
                }
                if (!(Request.QueryString["LangType"] == null))
                {
                    if (Request.QueryString["LangType"] != "")
                    {
                        m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                        if (1 == m_intContentLanguage)
                        {
                            m_intContentLanguage = m_refContentApi.DefaultContentLanguage;
                            m_refContentApi.ContentLanguage = m_intContentLanguage;
                        }
                        m_refContentApi.SetCookieValue("LastValidLanguageID", m_intContentLanguage.ToString());
                    }
                    else
                    {
                        if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                        {
                            m_intContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                            if (1 == m_intContentLanguage)
                            {
                                m_intContentLanguage = m_refContentApi.DefaultContentLanguage;
                                m_refContentApi.ContentLanguage = m_intContentLanguage;
                            }
                        }
                    }
                }
                else
                {
                    if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        m_intContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                        if (1 == m_intContentLanguage)
                        {
                            m_intContentLanguage = m_refContentApi.DefaultContentLanguage;
                            m_refContentApi.ContentLanguage = m_intContentLanguage;
                        }
                    }
                }
                if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || m_intContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                {
                    m_intContentLanguage = m_refContentApi.DefaultContentLanguage;
                }
                if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
                {
                    m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
                }
                else
                {
                    m_refContentApi.ContentLanguage = m_intContentLanguage;
                }

                AppeWebPath = m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath;
                int.TryParse(Request.QueryString["dentrylink"], out DEntryLink);
                action = Request.QueryString["Action"];
                sEditor = Request.QueryString["EditorName"];
                if ((Request.QueryString["folder"] != null)&& Request.QueryString["folder"] != "")
                {
                    m_folder = Convert.ToInt64(Request.QueryString["folder"].TrimEnd(','));
                }
                else
                {
                    m_folder = 0;
                }

                m_LibType = Request.QueryString["type"];
                scope = Request.QueryString["scope"];
                currentUserID = m_refContentApi.UserId;
                AppImgPath = m_refContentApi.AppImgPath;

                jsEditor.Text = sEditor;
                jsLibType.Text = m_LibType;
                jsFolder.Text = m_folder.ToString();
                qsRetfield.Text = Request.QueryString["retfield"];
                jsSitePath.Text = SitePath;
                jsOverwriteItemDenied.Text = m_refMsg.GetMessage("js: alert overwrite item denied");
                jsChooseItemToOverwrite.Text = m_refMsg.GetMessage("js: alert choose item to overwrite ed lib");
                jsChooseImgFileToOverwrite.Text = m_refMsg.GetMessage("js: alert choose image-file to use overwrite") + "\\n\\n" + m_refMsg.GetMessage("js: chosen lib type msg");
                jsCannotOverwrite.Text = m_refMsg.GetMessage("js: alert cannot change overwrite title");
                jsSelectLocalFile.Text = m_refMsg.GetMessage("js: alert select local file");
                jsWarnOverwrite.Text = m_refMsg.GetMessage("js: warning about to overwrite ed lib");
                jsSelectFolder.Text = m_refMsg.GetMessage("js: alert select folder");
                jsEditorClosed2.Text = m_refMsg.GetMessage("js: alert editor closed2");
                jsLibTitleReq.Text = m_refMsg.GetMessage("js: alert title required (library)");
                jsFilenameReq.Text = m_refMsg.GetMessage("js: alert filename is required");
                jsUploadImgWrong.Text = m_refMsg.GetMessage("js: confirm upload image wrong");
                jsUploadFileWrong.Text = m_refMsg.GetMessage("js: confirm upload file wrong");
                jsUploadCorrectFolder.Text = m_refMsg.GetMessage("js: confirm upload correct folder");
                jsUploadImgDenied.Text = m_refMsg.GetMessage("js: alert upload image denied");
                jsUploadFileDenied.Text = m_refMsg.GetMessage("js: alert upload file denied");
                jsUploadImgFileDenied.Text = m_refMsg.GetMessage("js: alert upload image/file denied");
                jsInvalidExt.Text = m_refMsg.GetMessage("js: alert invalid extension");
                jsForImg.Text = m_refMsg.GetMessage("js: alert for images");
                jsForFiles.Text = m_refMsg.GetMessage("js: alert for files");
                jsErrExtOverwrite.Text = m_refMsg.GetMessage("js: same extension for overwrite error") + "\\n\\n" + m_refMsg.GetMessage("js: local file ext prompt");
                jsLibFileExt.Text = m_refMsg.GetMessage("js: library file ext prompt");
                jsNoLocalPreview.Text = m_refMsg.GetMessage("js: alert no local preview");
                jsMakeSelection.Text = m_refMsg.GetMessage("js: alert make selection");
                jsStyleSheet.Text = m_refStyle.GetClientScript();
                jsLinkText.Text = sLinkText != "" ? (" + \'&selected=" + sLinkText.Replace("\'", "\\\'") + "\'") : "";

                lib_setting_data = m_refContentApi.GetLibrarySettings(Convert.ToInt64(m_folder)); //Used in the scripting layer
                jsImageExtensions.Text = lib_setting_data.ImageExtensions;
                jsFileExtensions.Text = lib_setting_data.FileExtensions;

                //Adding the MediaUploaderCommon User Control
                MediaUploaderCommon m_Moc;
                m_Moc = (MediaUploaderCommon)(LoadControl("controls/library/MediaUploaderCommon.ascx"));
                m_Moc.ID = "MediaUploaderCommon1";
                DataHolder.Controls.Add(m_Moc);

                if ((m_LibType == null) || (m_LibType == ""))
                {
                    m_LibType = "images";
                }
                if ((m_folder.ToString() == ""))
                {
                    m_folder = 0;
                }
                m_cPerms = m_refContentApi.LoadPermissions(m_folder, "folder", 0);

                if (Request.Browser.Platform.IndexOf("Win") == -1)
                {
                    IsMac = true;
                }

                if (Page.IsPostBack)
                {
                    Process_Form();
                }
                else
                {
                    if (sEditor != "JSEditor")
                    {
                        ctlEditor.FolderId = m_folder;
                        ctlEditor.Content = content_teaser;
                        Display_CustomSearchMetaData();
                    }
                    UploaderToolBar();
                }
            }
            catch (Exception ex)
            {
                Utilities.ShowError(ex.Message);
            }
            finally
            {
                m_refContentApi = null;
                m_refSiteApi = null;
            }
    }