Example #1
0
 protected override void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         base.Page_Load(sender, e);
         folder_data = m_refContentApi.GetFolderById(m_iID, true, true);
         if (folder_data.FolderType == 1) //blog
         {
             if (!CheckAccess())
             {
                 throw (new Exception(this.GetMessage("com: user does not have permission")));
             }
             else
             {
                 if (Page.IsPostBack)
                 {
                     Process_Add();
                 }
                 else
                 {
                     Display_Add();
                 }
             }
         }
         else
         {
             throw (new Exception(this.GetMessage("blog not found")));
         }
     }
     catch (Exception ex)
     {
         Utilities.ShowError(ex.Message);
     }
 }
Example #2
0
        // subroutine for Root Folder button
        // recursive function that returns information of subdirectories
        private void BrowseRecursion(string dirPath, FolderData folderData)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(dirPath);

            // compute base data of this folder

            folderData.Path = dirPath;
            folderData.NumberFiles = dirInfo.GetFiles().Length;
            folderData.FolderSize = 0;

            for (int f = 0; f < folderData.NumberFiles; f++)
                folderData.FolderSize += dirInfo.GetFiles()[f].Length;

            // compute data of subdirectories

            folderData.SubFolderData = new List<FolderData>();

            DirectoryInfo[] subDirInfo = dirInfo.GetDirectories();

            for (int d = 0; d < subDirInfo.Length; d++)
            {
                FolderData subFolderData = new FolderData();

                folderData.SubFolderData.Add(subFolderData);

                BrowseRecursion(subDirInfo[d].FullName, folderData.SubFolderData[d]);

                folderData.NumberFiles += folderData.SubFolderData[d].NumberFiles;
                folderData.FolderSize += folderData.SubFolderData[d].FolderSize;
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Folder"/> class.
        /// </summary>
        /// <param name="client"><see cref="T:TcmCoreService.Client" /></param>
        /// <param name="folderData"><see cref="T:Tridion.ContentManager.CoreService.Client.FolderData" /></param>
        protected Folder(Client client, FolderData folderData)
            : base(client, folderData)
        {
            if (folderData == null)
                throw new ArgumentNullException("folderData");

            mFolderData = folderData;
        }
Example #4
0
        /// <summary>
        /// Entry point for recursion to display data on ListView.
        /// </summary>
        private void DisplayResults(FolderData rootData)
        {
            f_folderInfo.Items.Clear();

            DisplayResultsRecursion(rootData, 0);

            f_folderInfo.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
        }
Example #5
0
        public static FolderResult From(FolderData item, string currentUserId)
        {
            var result = new FolderResult { LinkedSchema = LinkEntry.From(item.LinkedSchema, Resources.LabelLinkedSchema, currentUserId) };

            AddCommonProperties(item, result);
            AddPropertiesForRepositoryLocalObject(item, result, currentUserId);
            return result;
        }
Example #6
0
 public SetBackup()
 {
     InitializeComponent();
     _backupSet = new FolderData();
     int loadResult = PopulateListBox();
     if(!(loadResult == (int)Enumeration.ReturnCodes.Success))
     {
         ShowErrorMessage(loadResult);
     }
 }
Example #7
0
 public Folder(FolderData obj, bool alreadyEncrypted = false)
 {
     BuildDomainModel(this, obj, new HashSet <string>
     {
         "Id",
         "Name"
     }, alreadyEncrypted, new HashSet <string> {
         "Id"
     });
     RevisionDate = obj.RevisionDate;
 }
Example #8
0
        public async Task <bool> SyncAsync(string id)
        {
            if (!_authService.IsAuthenticated)
            {
                return(false);
            }

            SyncStarted();

            var cipher = await _cipherApiRepository.GetByIdAsync(id).ConfigureAwait(false);

            if (!cipher.Succeeded)
            {
                SyncCompleted(false);

                if (Application.Current != null && (cipher.StatusCode == System.Net.HttpStatusCode.Forbidden ||
                                                    cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized))
                {
                    MessagingCenter.Send(Application.Current, "Logout", (string)null);
                }

                return(false);
            }

            try
            {
                switch (cipher.Result.Type)
                {
                case Enums.CipherType.Folder:
                    var folderData = new FolderData(cipher.Result, _authService.UserId);
                    await _folderRepository.UpsertAsync(folderData).ConfigureAwait(false);

                    break;

                case Enums.CipherType.Login:
                    var loginData = new LoginData(cipher.Result, _authService.UserId);
                    await _loginRepository.UpsertAsync(loginData).ConfigureAwait(false);

                    break;

                default:
                    SyncCompleted(false);
                    return(false);
                }
            }
            catch (SQLite.SQLiteException)
            {
                SyncCompleted(false);
                return(false);
            }

            SyncCompleted(true);
            return(true);
        }
        private static void ValidateFolder(SortedFolderEntries entries, LazyUTF8String entryToValidate, bool isIncludedValue)
        {
            entries.TryGetValue(entryToValidate, out FolderEntryData folderEntryData).ShouldBeTrue();
            folderEntryData.ShouldNotBeNull();
            folderEntryData.IsFolder.ShouldBeTrue();

            FolderData folderData = folderEntryData as FolderData;

            folderData.ShouldNotBeNull();
            folderData.IsIncluded.ShouldEqual(isIncludedValue, "IsIncluded does not match expected value.");
        }
Example #10
0
 public FolderTreeNode(FolderData data)
 {
     Name        = data.Name;
     Visible     = data.Visible;
     Freeze      = data.Freeze;
     Render      = data.Render;
     Color       = data.Color;
     Box         = data.Box;
     WasExpanded = data.Expanded;
     ID          = data.ID;
 }
Example #11
0
        public HomeFolders()
        {
            Folders = new ObservableCollection <Folder>();
            FolderData    _context = new FolderData();
            List <Folder> folders  = _context.folders();

            foreach (Folder folder in folders)
            {
                Folders.Add(folder);
            }
        }
Example #12
0
        public ListRecipesModel(string path, string name)
        {
            Title       = name;
            RecipeLists = new ObservableCollection <RecipeListItem>();
            FolderData            _context    = new FolderData();
            List <RecipeListItem> recipeLists = _context.recipes(path);

            foreach (RecipeListItem recipe in recipeLists)
            {
                RecipeLists.Add(recipe);
            }
        }
Example #13
0
        /// <summary>
        /// Reload the <see cref="Folder" /> with the specified <see cref="T:Tridion.ContentManager.CoreService.Client.FolderData" />
        /// </summary>
        /// <param name="folderData"><see cref="T:Tridion.ContentManager.CoreService.Client.FolderData" /></param>
        protected void Reload(FolderData folderData)
        {
            if (folderData == null)
            {
                throw new ArgumentNullException("folderData");
            }

            mFolderData = folderData;
            base.Reload(folderData);

            mLinkedSchema = null;
        }
Example #14
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            FolderData ds = new FolderData();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Example #15
0
 public void Include()
 {
     this.IsIncluded = true;
     for (int i = 0; i < this.ChildEntries.Count; i++)
     {
         if (this.ChildEntries[i].IsFolder)
         {
             FolderData folderData = (FolderData)this.ChildEntries[i];
             folderData.Include();
         }
     }
 }
Example #16
0
        private static void GetFolderData(pstsdk.definition.pst.folder.IFolder rootfolder, string currpath, bool filtered, bool includemessages, ref List <FolderData> folders)
        {
            if (rootfolder.Name != string.Empty)
            {
                currpath += (currpath != string.Empty ? "\\" : string.Empty) + rootfolder.Name;
            }

            if (rootfolder.Name == string.Empty)
            {
                currpath = "Root Container";
            }

            FolderData folderdata = null;

            if ((folderdata = folders.FirstOrDefault(x => (x.FolderPath == currpath) || (x.FolderEntryId == rootfolder.EntryID.ToString()))) != null)
            {
                folderdata.NodeId = rootfolder.Node;
                if (folderdata.FolderEntryId == string.Empty)
                {
                    folderdata.FolderEntryId = rootfolder.EntryID.ToString();
                }
                if (folderdata.FolderPath == string.Empty)
                {
                    folderdata.FolderPath = currpath;
                }
            }
            else if (filtered == false)
            {
                folders.Add(folderdata = new FolderData(currpath, rootfolder, includemessages ? (uint)rootfolder.MessageCount : 0, includemessages ? (uint)rootfolder.Messages.Count(x => x.AttachmentCount > 0) : 0));
            }

            if (folderdata != null && includemessages == true)
            {
                List <MessageData> messagedatalist = folderdata.MessageData;
                foreach (pstsdk.definition.pst.message.IMessage msg in rootfolder.Messages)
                {
                    MessageData messagedata = new MessageData(msg.EntryID.ToString(), msg.Node, (uint)msg.AttachmentCount);
                    messagedatalist.Add(messagedata);
                    msg.Dispose();
                }
            }

            if (rootfolder.Name == string.Empty)
            {
                currpath = string.Empty;
            }

            foreach (pstsdk.definition.pst.folder.IFolder folder in rootfolder.SubFolders)
            {
                GetFolderData(folder, currpath, filtered, includemessages, ref folders);
                folder.Dispose();
            }
        }
Example #17
0
        public static Folder ToGenericFolder(this FolderData item, int LanguageId)
        {
            var Folder = new Folder()
            {
                Name        = item.Name,
                HasChildren = item.HasChildren,
                Id          = item.Id,
                ParentId    = item.ParentId,
                LanguageId  = LanguageId
            };

            return(Folder);
        }
Example #18
0
        void SaveRestoreFolder(BackupProfileData profile, string path)
        {
            //TODO - only one destination folder is supported right now
            profile.TargetRestoreFolderList.Clear();
            var folderData = new FolderData()
            {
                IsFolder = true, IsAvailable = true, Path = path
            };

            profile.TargetRestoreFolderList.Add(folderData);

            BackupProjectRepository.Instance.SaveProject();
        }
Example #19
0
        private void AnalyzeResults()
        {
            // analyze the test results
            Console.WriteLine("");
            if (_folders.Count == 0)
            {
                // Failed test. Apparently the folder existed before starting the test.
                Console.WriteLine($"ERROR - unexpected: {_folders.Count} folders were created");
            }
            else if (_folders.Count == 1)
            {
                // OK test. The bug did not apprear
                Console.WriteLine($"OK - {_folders.Count} folders were created"); // one folder was created which is good. The bug is not reproduced
            }
            else if (_folders.Count > 1)
            {
                // Expected test result
                Console.WriteLine($"ERROR {_folders.Count} folders were created with the same folder name: '{_folderPath}'");

                CoreServiceClient client = new CoreServiceClient(ConfigurationManager.AppSettings["endpointName"],
                                                                 ConfigurationManager.AppSettings["endpointURI"]);
                client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(
                    ConfigurationManager.AppSettings["username"], ConfigurationManager.AppSettings["password"]);


                // Proving that IsExistingObject operation returns an exception when the target folder name is not unique
                Console.WriteLine("");
                try
                {
                    bool isExistingObject = client.IsExistingObject(_folderPath);
                    Console.WriteLine($"OK IsExistingObject '{_folderPath}' returned '{isExistingObject.ToString()}'");
                }
                catch (Exception e)
                {
                    Console.WriteLine($"ERROR: IsExistingObject '{_folderPath}' returned exception '{e.Message}'");
                }


                // Proving that Read operation returns an exception when the target folder name is not unique
                Console.WriteLine("");
                try
                {
                    FolderData folderData = (FolderData)client.Read(_folderPath, new ReadOptions());
                    Console.WriteLine($"OK Read '{_folderPath}' returned FolderData for '{folderData.Id}'");
                }
                catch (Exception e)
                {
                    Console.WriteLine($"ERROR: Read '{_folderPath}' returned exception '{e.Message}'");
                }
            }
        }
Example #20
0
        private FolderData CreateFolder(string name, string slug, int sort, int?parentId = null)
        {
            FolderData folder = new FolderData();

            folder.Name          = name;
            folder.Slug          = slug;
            folder.Sort          = sort;
            folder.ParentId      = parentId;
            folder.FolderType    = FolderType.Content;
            folder.IsPublished   = true;
            folder.IsSubsiteRoot = false;

            return(folder);
        }
 public void Reset()
 {
     UnityFolder[0] = new FolderData {
         name = "Assets", folderPath = Application.dataPath
     };
     UnityFolder[1] = new FolderData {
         name = "StreamingAssetsPath", folderPath = Application.streamingAssetsPath
     };
     UnityFolder[2] = new FolderData {
         name = "PersistentDataPath", folderPath = Application.persistentDataPath
     };
     UnityFolder[3] = new FolderData {
         name = "Resources", folderPath = Path.Combine(Application.dataPath, "Resources")
     };
 }
Example #22
0
        public IFacadeUpdateResult <FolderData> SaveFolder(FolderData data)
        {
            UnitOfWork.BeginTransaction();
            IFacadeUpdateResult <FolderData> result = FolderSystem.SaveFolder(data);

            if (result.IsSuccessful)
            {
                UnitOfWork.CommitTransaction();
            }
            else
            {
                UnitOfWork.RollbackTransaction();
            }
            return(result);
        }
Example #23
0
 private void button2_Click(object sender, EventArgs e)
 {
     path = folderBrowserDialog1.SelectedPath;
     if (!string.IsNullOrEmpty(path) && !string.IsNullOrWhiteSpace(path))
     {
         FolderData di     = new FolderData(new DirectoryInfo(path));
         string     result = di.TreeToJson();
         File.WriteAllText("data.json", result);
         label2.Visible = true;
         textBox1.Clear();
     }
     else
     {
         MessageBox.Show("Choose the directory!");
     }
 }
Example #24
0
        /// <summary>
        /// Fill and Refresh the ListViewImages in the Main Program and refresh the header
        /// </summary>

        public static void RefershImageListAndHeader()
        {
            // Skip if the folder do not exsist
            if (!touchIMAGE.Fonctions.IO.DirectoryExsiste(ProgramData.SelectedFolder))
            {
                MessageBox.Show("Error! File or Folder not exist");
                return;
            }

            FolderData folder = new FolderData(ProgramData.SelectedFolder);

            // List View Immages
            Graphs.Controllers.ListViewImageController.Populate(folder);
            //Header
            Graphs.Controllers.HeaderController.RefreshHeader(folder);
        }
Example #25
0
        public static void createFolder()
        {
            string folderWebDavUrl = "/webdav/020%20Content/Building%20Blocks/Content/wstest";

            CoreServicesUtil coreServicesUtil = new CoreServicesUtil();

            FolderData folderData = coreServicesUtil.getFolderData(folderWebDavUrl);


            FolderData folderDataChild = folderData.AddFolderData();

            folderDataChild.Title = "childFolder";

            folderDataChild = (FolderData)coreServicesUtil.coreServiceClient.Save(folderDataChild, coreServicesUtil.readOptions);
            coreServicesUtil.coreServiceClient.Close();
        }
Example #26
0
        public IFacadeUpdateResult <FolderData> SaveFolderLanguage(FolderData dto, object languageId)
        {
            UnitOfWork.BeginTransaction();
            IFacadeUpdateResult <FolderData> result = FolderSystem.SaveFolderLanguage(dto, languageId);

            if (result.IsSuccessful)
            {
                UnitOfWork.CommitTransaction();
            }
            else
            {
                UnitOfWork.RollbackTransaction();
            }

            return(result);
        }
Example #27
0
        public void RenderControl()
        {
            treeViewFolder.Nodes.Clear();
            //treeViewFolder = new TreeView();
            //FolderData = fileMessages;
            FolderData.OrderBy(x => x.FilePath);
            Dictionary <string, TreeNode> allNodes = new Dictionary <string, TreeNode>();
            TreeNode parentNode = null;
            TreeNode rootNode   = new TreeNode();

            rootNode.Text = DisplayMessages.ApplicationName;
            rootNode.Name = DisplayMessages.ApplicationName + "\\";
            string             treeName = "";
            List <FileMessage> tempData = FolderData;

            foreach (var fm in tempData)
            {
                string   nodename = DisplayMessages.ApplicationName + "\\";
                string[] nodePath = fm.FilePath.Split('\\');
                parentNode = rootNode;
                if (nodePath.Length > 1)
                {
                    for (int i = 0; i < nodePath.Length; i++)
                    {
                        if (nodePath[i].Length > 0)
                        {
                            nodename += nodePath[i] + "\\";
                            TreeNode[] temp = parentNode.Nodes.Find(nodename, false);

                            if (temp.Length > 0)
                            {
                                parentNode = temp[0];
                            }
                            else
                            {
                                TreeNode newNode = new TreeNode();
                                newNode.Text = nodePath[i];
                                newNode.Name = nodename;
                                int newIndex = parentNode.Nodes.Add(newNode);
                                parentNode = parentNode.Nodes[newIndex];
                            }
                        }
                    }
                }
            }
            treeViewFolder.Nodes.Add(rootNode);
        }
Example #28
0
        public async Task UpsertAsync(FolderData folder)
        {
            var folders = await _stateService.GetEncryptedFoldersAsync();

            if (folders == null)
            {
                folders = new Dictionary <string, FolderData>();
            }
            if (!folders.ContainsKey(folder.Id))
            {
                folders.Add(folder.Id, null);
            }
            folders[folder.Id] = folder;
            await _stateService.SetEncryptedFoldersAsync(folders);

            _decryptedFolderCache = null;
        }
 private void spliteData()
 {
     FolderData.Clear();
     FileData.Clear();
     foreach (UserFileModel file in Data)
     {
         if (file.is_folder)
         {
             FolderData.Add(file);
         }
         else
         {
             FileData.Add(file);
             Debug.WriteLine("file", file.file_name);
         }
     }
 }
Example #30
0
 private System.Text.StringBuilder pShowFolders(FolderData inFold)
 {
     System.Text.StringBuilder ret = new System.Text.StringBuilder();
         int z;
         ret.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + "\r\n");
         ret.Append("<tr><td colspan=2 class=\"info\">");
         ret.Append("&#160;<A href=\"JavaScript:folderClick(\'" + inFold.Id + "\',\'" + inFold.NameWithPath.Replace("\'", "\\\'").Replace("\\", "\\\\").Replace("/", "\\/") + "\')\">" + inFold.Name + "</a></td></tr>" + "\r\n");
         if (inFold.ChildFolders != null)
         {
             for (z = 0; z <= (inFold.ChildFolders.Length - 1); z++)
             {
                 ret.Append(pShowFolder(inFold.ChildFolders[z], 1));
             }
         }
         ret.Append("</table>");
         return (ret);
 }
Example #31
0
 private void Page_Load(System.Object sender, System.EventArgs e)
 {
     m_refMsg = m_siteRef.EkMsgRef;
         Utilities.ValidateUserLogin();
         if (m_siteRef.RequestInformationRef.IsMembershipUser == 1 || m_siteRef.RequestInformationRef.UserId == 0)
         {
             Response.Redirect(m_siteRef.ApplicationPath + "reterror.aspx?info=" + Server.UrlEncode(m_refMsg.GetMessage("msg login cms user")), false);
             return;
         }
         JSInc.Text = "<link type=\"text/css\" href=\"" + m_siteRef.AppPath + "csslib/ektron.workarea.css\"/>";
         Collection foldCol = new Collection();
         System.Text.StringBuilder outSB = new System.Text.StringBuilder();
         CalendarAPI cAPI = new CalendarAPI(m_siteRef.RequestInformationRef);
         FolderData fDat = new FolderData();
         fDat = cAPI.GetFolderWithChildren(0);
         TestDate.Text += pShowFolders(fDat).ToString();
 }
        public FolderData GetTreeNodes(int UserId)
        {
            FolderData folderData = new FolderData();

            //SqlParameter[] spParameters = new SqlParameter[1];
            //spParameters[0] = new SqlParameter("@UserId", UserId);

            ArrayList sqlParams = new ArrayList();
            {
                sqlParams.Add(new SqlParameter("@UserId", UserId).SqlValue);
            }

            //SqlHelper.FillDataset(SqlHelper.DbConnectionString, CommandType.StoredProcedure, "vts_spTreeNodesGetAll", folderData, new string[] { "TreeNodes" },spParameters);
            DbConnection.db.LoadDataSet("vts_spTreeNodesGetAll", folderData, new string[] { "TreeNodes" }, sqlParams.ToArray());

            return folderData;
        }
        private void onFolderRootChanged(FolderData root)
        {
            if (this.selectableManager != null)
            {
                this.selectableManager.SelectedFileCountChanged -= onSelectedFileCountChanged;
                this.selectableManager.Dispose();
                this.selectableManager = null;
            }

            this.root = root;
            NotifyPropertyChanged("RootSource");

            if (root != null)
            {
                this.selectableManager = new SelectableManager(root);
                this.selectableManager.SelectedFileCountChanged += onSelectedFileCountChanged;
            }
        }
        void SetupFolderData(FolderData folderData)
        {
            m_FolderData = new List <FolderData> {
                folderData
            };

            // Send new data to existing folderLists
            foreach (var list in m_ProjectFolderLists)
            {
                list.folderData = GetFolderData();
            }

            // Send new data to existing filterUIs
            foreach (var filterUI in m_FilterUIs)
            {
                filterUI.filterList = GetFilterList();
            }
        }
Example #35
0
        public FolderData GetTreeNodes(int UserId)
        {
            FolderData folderData = new FolderData();

            //SqlParameter[] spParameters = new SqlParameter[1];
            //spParameters[0] = new SqlParameter("@UserId", UserId);

            ArrayList sqlParams = new ArrayList();

            {
                sqlParams.Add(new SqlParameter("@UserId", UserId).SqlValue);
            }

            //SqlHelper.FillDataset(SqlHelper.DbConnectionString, CommandType.StoredProcedure, "vts_spTreeNodesGetAll", folderData, new string[] { "TreeNodes" },spParameters);
            DbConnection.db.LoadDataSet("vts_spTreeNodesGetAll", folderData, new string[] { "TreeNodes" }, sqlParams.ToArray());

            return(folderData);
        }
Example #36
0
        public JsonResult getFolder(string p)
        {
            try
            {
                FolderData folderData = new FolderData();  // FolderData has the relative path and arrays of folders and files.

                if (String.IsNullOrEmpty(p))
                {
                    p = "";
                }
                folderData.relativePath = p;

                string root = Server.MapPath(ConfigurationManager.AppSettings["rootFolder"]);
                // warning: When using "Combine," if relativePath is \ or another "absolute" path, only it is returned!
                string        fullpath = Path.Combine(root, p);
                DirectoryInfo di       = new DirectoryInfo(fullpath);

                var folders = di.GetDirectories();
                if (folders.Count() > 0)
                {
                    folderData.folders = folders.Select(x => x.FullName.Replace(root, "")).ToArray();
                }
                else
                {
                    folderData.folders = new List <string>().ToArray();
                }

                var files = di.GetFiles();
                if (files.Count() > 0)
                {
                    folderData.files = files.Select(x => x.FullName.Replace(root, "")).ToArray();
                }
                else
                {
                    folderData.files = new List <string>().ToArray(); // TODO: ???
                }
                //return new JsonResult(Newtonsoft.Json.JsonConvert.SerializeObject(folderData));
                return(Json(folderData, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw new Exception("Could not find path." + ex.Message);
            }
        }
Example #37
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="folderID"></param>
        /// <param name="recursive"></param>
        /// <param name="srcSchemaID"></param>
        /// <param name="destSchemaID"></param>
        public static string UpdateSchemaForComponent(string folderID, bool recursive, string srcSchemaID, string destSchemaID, bool isMultiMediaComp)
        {
            cs_client = CoreServiceProvider.CreateCoreService();
            StringBuilder        sb          = new StringBuilder();
            FolderData           folder      = cs_client.Read(folderID, null) as FolderData;
            SchemaData           schema      = cs_client.Read(destSchemaID, null) as SchemaData;
            XNamespace           ns          = schema.NamespaceUri;
            XElement             items       = cs_client.GetListXml(folder.Id, SetComponenetFilterCriterias(isMultiMediaComp));
            List <ComponentData> failedItems = new List <ComponentData>();

            foreach (XElement item in items.Elements())
            {
                ComponentData component = cs_client.Read(item.Attribute("ID").Value, null) as ComponentData;

                if (!component.Schema.IdRef.Equals(srcSchemaID))
                {
                    // If the component is not of the schmea that we want to change from, do nothing...
                    return("");
                }

                if (component.Schema.IdRef.Equals(schema.Id))
                {
                    // If the component already has this schema, don't do anything.
                    return("");
                }

                component = cs_client.TryCheckOut(component.Id, new ReadOptions()) as ComponentData;


                if (component.IsEditable.Value)
                {
                    component.Schema.IdRef = destSchemaID;
                    component.Metadata     = new XElement(ns + "Metadata").ToString();
                    cs_client.Save(component, null);
                    cs_client.CheckIn(component.Id, null);
                }
                else
                {
                    sb.AppendLine("Schema Can not be updated for: " + component.Id);
                    sb.AppendLine("");
                }
            }
            return(sb.ToString());
        }
Example #38
0
        public void CreateFolder(string threadId)
        {
            try
            {
                Console.WriteLine($"{threadId} - Start thread to create folder '{_folderPath}'");

                CoreServiceClient client = new CoreServiceClient(ConfigurationManager.AppSettings["endpointName"], ConfigurationManager.AppSettings["endpointURI"]);
                client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(ConfigurationManager.AppSettings["username"], ConfigurationManager.AppSettings["password"]);

                Console.WriteLine($"{threadId} - trying to connect to core service at {ConfigurationManager.AppSettings["endpointURI"]}");
                string apiVersion = client.GetApiVersion();
                Console.WriteLine($"{threadId} - API version: {apiVersion}");

                int    lastSlashIdx  = _folderPath.LastIndexOf("/");
                string newFolderPath = _folderPath.Substring(lastSlashIdx + 1);
                string parentFolder  = _folderPath.Substring(0, lastSlashIdx);

                if (!client.IsExistingObject(parentFolder))
                {
                    Console.WriteLine($"{threadId} - ERROR base path does not exist '{parentFolder}'");
                    return;
                }

                FolderData parentFolderData = (FolderData)client.Read(parentFolder, new ReadOptions());

                if (client.IsExistingObject(_folderPath))
                {
                    FolderData folderData = (FolderData)client.Read(_folderPath, new ReadOptions());
                    Console.WriteLine($"{threadId} - OK folder already exists {folderData.Id} '{_folderPath}'");
                }
                else
                {
                    FolderData newFolderData = (FolderData)client.GetDefaultData(ItemType.Folder, parentFolderData.Id, new ReadOptions());
                    newFolderData.Title = newFolderPath;
                    FolderData folderData = (FolderData)client.Save(newFolderData, new ReadOptions());
                    _folders.Add(folderData.Id);
                    Console.WriteLine($"{threadId} - Created new content folder {folderData.Id} '{newFolderPath}' under folder '{parentFolderData.Title}'");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{threadId} - ERROR exception: '{ex.Message}'");
            }
        }
Example #39
0
        public SubjectMatterMock()
        {
            _lFolderData = new List <FolderData>();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PrototypeExampleData", "SubjectMatter.csv");

            foreach (var l in File.ReadLines(path))
            {
                string[]   ss        = l.Split('|');
                string     id        = ss[0];
                string     key       = ss[1];
                string     title     = key + " " + ss[2];
                FolderData newFolder = new FolderData()
                {
                    Id = id, Title = title, Key = key, Folder = true, Lazy = false
                };

                FolderData parentFolder = null;
                if (key.Length > 3)
                {
                    string parentKey  = key.Substring(0, key.Length - 3);
                    string mainKey    = key.Substring(0, 3);
                    var    mainFolder = (from FolderData f in _lFolderData
                                         where f.Key == mainKey
                                         select f).FirstOrDefault();
                    if (parentKey == mainKey)
                    {
                        parentFolder = mainFolder;
                    }
                    else
                    {
                        parentFolder = GetFolderDataByKey(mainFolder, parentKey);
                    }
                }
                if (parentFolder == null)
                {
                    _lFolderData.Add(newFolder);
                }
                else
                {
                    parentFolder.Children.Add(newFolder);
                }
            }
        }
Example #40
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _MessageHelper = _ContentApi.EkMsgRef;
         Utilities.ValidateUserLogin();

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

        if (!String.IsNullOrEmpty(Request.QueryString["fid"]))
        {
            _FolderID = Convert.ToInt64(Request.QueryString["fid"]);
            _FolderData = _ContentApi.GetFolderById(_FolderID);
        }

        CmsDeviceConfiguration cDevice = new CmsDeviceConfiguration(_ContentApi.RequestInformationRef);
        criteria.OrderByField = Ektron.Cms.Device.CmsDeviceConfigurationProperty.Order;
        criteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
        dList = cDevice.GetList(criteria);

        if (!Page.IsPostBack)
        {
            if (_FolderData != null)
            {
                if (dList.Count > 0)
                {
                    ddlDevices.Items.Clear();

                    foreach (CmsDeviceConfigurationData dItem in dList)
                    {
                        ddlDevices.Items.Add(new ListItem(dItem.Name, dItem.Id.ToString()));
                    }
                    if (!(ddlDevices.Items.Count > 0))
                        Response.Redirect(ContentLink().Replace("ekfrm", "id"), false);
                }
                else
                {
                    Response.Redirect(ContentLink().Replace("ekfrm", "id"), false);
                }
            }
        }
    }
Example #41
0
 private System.Text.StringBuilder pShowFolder(FolderData inFold, int level)
 {
     System.Text.StringBuilder ret = new System.Text.StringBuilder();
         int z;
         ret.Append("<tr><td>&#160;&#160;</td><td class=\"info\" style=\"border-left: #000000 1px solid ;\">");
         ret.Append("<span style=\"text-decoration: line-through ;\">");
         for (z = 1; z <= level; z++)
         {
             ret.Append("&#160;&#160;");
         }
         ret.Append("</span>");
         ret.Append("&#160;<A href=\"JavaScript:folderClick(\'" + inFold.Id + "\',\'" + inFold.NameWithPath.Replace("\'", "\\\'").Replace("\\", "\\\\").Replace("/", "\\/") + "\')\">" + inFold.Name + "</a></td></tr>" + "\r\n");
         if (inFold.ChildFolders != null)
         {
             for (z = 0; z <= (inFold.ChildFolders.Length - 1); z++)
             {
                 ret.Append(pShowFolder(inFold.ChildFolders[z], level + 1));
             }
         }
         return (ret);
 }
Example #42
0
        private static void GetFolderData(pstsdk.definition.pst.folder.IFolder rootfolder, string currpath, bool filtered, bool includemessages, ref List<FolderData> folders)
        {
            if (rootfolder.Name != string.Empty)
                currpath += (currpath != string.Empty ? "\\" : string.Empty) + rootfolder.Name;

            if (rootfolder.Name == string.Empty)
                currpath = "Root Container";

            FolderData folderdata = null;
            if ((folderdata = folders.FirstOrDefault(x => (x.FolderPath == currpath) || (x.FolderEntryId == rootfolder.EntryID.ToString()))) != null)
            {
                folderdata.NodeId = rootfolder.Node;
                if(folderdata.FolderEntryId == string.Empty)
                    folderdata.FolderEntryId = rootfolder.EntryID.ToString();
                if (folderdata.FolderPath == string.Empty)
                    folderdata.FolderPath = currpath;
            }
            else if (filtered == false)
                folders.Add(folderdata = new FolderData(currpath, rootfolder, includemessages ? (uint)rootfolder.MessageCount : 0, includemessages ? (uint)rootfolder.Messages.Count(x => x.AttachmentCount > 0) : 0));

            if (folderdata != null && includemessages == true)
            {
                List<MessageData> messagedatalist = folderdata.MessageData;
                foreach (pstsdk.definition.pst.message.IMessage msg in rootfolder.Messages)
                {
                    MessageData messagedata = new MessageData(msg.EntryID.ToString(), msg.Node, (uint)msg.AttachmentCount);
                    messagedatalist.Add(messagedata);
                    msg.Dispose();
                }
            }

            if (rootfolder.Name == string.Empty)
                currpath = string.Empty;

            foreach (pstsdk.definition.pst.folder.IFolder folder in rootfolder.SubFolders)
            {
                GetFolderData(folder, currpath, filtered, includemessages, ref folders);
                folder.Dispose();
            }
        }
Example #43
0
        private void DisplayResultsRecursion(FolderData displayData, int recurseDepth)
        {
            if (recurseDepth >= f_recursionDepth.Value)
                return;

            string msg = "";

            for (int m = 0; m < recurseDepth; m++)
                msg += "      ";
            msg += Utility.StringFormat.GetLastDirectoryOnly(displayData.Path + @"\");  // cheat for creating folder name

            ListViewItem topItem = new ListViewItem(msg);
            topItem.SubItems.Add(displayData.NumberFiles.ToString());
            topItem.SubItems.Add(displayData.FolderSize.ToString());

            f_folderInfo.Items.Add(topItem);

            // a dvelopment mistake was made
            if (displayData == null || displayData.SubFolderData == null)
                return;

            foreach (FolderData currData in displayData.SubFolderData)
                DisplayResultsRecursion(currData, recurseDepth + 1);
        }
Example #44
0
    private void Display_PropertiesTab(ContentData data)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "NAME";
        colBound.ItemStyle.CssClass = "label";
        PropertiesGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        PropertiesGrid.Columns.Add(colBound);
        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("NAME", typeof(string)));
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        int i = 0;
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic title");
        dr[1] = entry_edit_data.Title;
        dt.Rows.Add(dr);
        dr = dt.NewRow();

        content_title.Value = data.Title;

        dr[0] = m_refMsg.GetMessage("generic id");
        dr[1] = entry_edit_data.Id;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic language");
        dr[1] = LanguageName;
        dt.Rows.Add(dr);

        // commerce

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl product type xml config");
        dr[1] = entry_edit_data.ProductType.Title;
        xml_id = entry_edit_data.ProductType.Id;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl calatog entry sku");
        dr[1] = entry_edit_data.Sku;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl number of units");
        dr[1] = entry_edit_data.QuantityMultiple;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl tax class");
        dr[1] = (new TaxClass(m_refContentApi.RequestInformationRef)).GetItem(entry_edit_data.TaxClassId).Name;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl archived");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsArchived ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl buyable");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsBuyable ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        // dimensions

        string sizeMeasure = m_refMsg.GetMessage("lbl inches");
        string weightMeasure = m_refMsg.GetMessage("lbl pounds");

        if (m_refContentApi.RequestInformationRef.MeasurementSystem == Ektron.Cms.Common.EkEnumeration.MeasurementSystem.Metric)
        {

            sizeMeasure = m_refMsg.GetMessage("lbl centimeters");
            weightMeasure = m_refMsg.GetMessage("lbl kilograms");

        }

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl tangible");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsTangible ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl height");
        dr[1] = entry_edit_data.Dimensions.Height + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl width");
        dr[1] = entry_edit_data.Dimensions.Width + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl length");
        dr[1] = entry_edit_data.Dimensions.Length + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl weight");
        dr[1] = entry_edit_data.Weight.Amount + " " + weightMeasure;
        dt.Rows.Add(dr);

        // dimensions

        // inventory
        InventoryApi inventoryApi = new InventoryApi();
        InventoryData inventoryData = inventoryApi.GetInventory(entry_edit_data.Id);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl disable inventory");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.DisableInventoryManagement ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl in stock");
        dr[1] = inventoryData.UnitsInStock;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl on order");
        dr[1] = inventoryData.UnitsOnOrder;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl reorder");
        dr[1] = inventoryData.ReorderLevel;
        dt.Rows.Add(dr);

        // inventory

        // end commerce

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content status label");
        switch (entry_edit_data.ContentStatus.ToLower())
        {
            case "a":
                dr[1] = m_refMsg.GetMessage("status:Approved (Published)");
                break;
            case "o":
                dr[1] = m_refMsg.GetMessage("status:Checked Out");
                break;
            case "i":
                dr[1] = m_refMsg.GetMessage("status:Checked In");
                break;
            case "p":
                dr[1] = m_refMsg.GetMessage("status:Approved (PGLD)");
                break;
            case "m":
                dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Deletion") + "</font>";
                break;
            case "s":
                dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Approval") + "</font>";
                break;
            case "t":
                dr[1] = m_refMsg.GetMessage("status:Waiting Approval");
                break;
            case "d":
                dr[1] = "Deleted (Pending Start Date)";
                break;
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content LUE label");
        dr[1] = entry_edit_data.LastEditorFirstName + " " + entry_edit_data.LastEditorLastName;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content LED label");
        dr[1] = entry_edit_data.DateModified;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic start date label");
        if (entry_edit_data.GoLive == DateTime.MinValue || entry_edit_data.GoLive == DateTime.MaxValue)
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            dr[1] = entry_edit_data.GoLive.ToLongDateString() + " " + entry_edit_data.GoLive.ToShortTimeString();
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic end date label");
        if (entry_edit_data.EndDate == DateTime.MinValue || entry_edit_data.EndDate == DateTime.MaxValue)
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            dr[1] = entry_edit_data.EndDate.ToLongDateString() + " " + entry_edit_data.EndDate.ToShortTimeString();
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("End Date Action Title");
        if (!(entry_edit_data.EndDate == DateTime.MinValue || entry_edit_data.EndDate == DateTime.MaxValue))
        {
            if (entry_edit_data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_archive_display)
            {
                dr[1] = m_refMsg.GetMessage("Archive display descrp");
            }
            else if (entry_edit_data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_refresh)
            {
                dr[1] = m_refMsg.GetMessage("Refresh descrp");
            }
            else
            {
                dr[1] = m_refMsg.GetMessage("Archive expire descrp");
            }
        }
        else
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content DC label");
        dr[1] = data.DateCreated; //DisplayDateCreated
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = this.m_refMsg.GetMessage("lbl approval method");
        if (data.ApprovalMethod == 1)
        {
            dr[1] = m_refMsg.GetMessage("display for force all approvers");
        }
        else
        {
            dr[1] = m_refMsg.GetMessage("display for do not force all approvers");
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content approvals label");
        System.Text.StringBuilder approvallist = new System.Text.StringBuilder();
        if (approvaldata == null)
        {
            approvaldata = m_refContentApi.GetCurrentApprovalInfoByID(m_intId);
        }
        approvallist.Append(m_refMsg.GetMessage("none specified msg"));
        if (!(approvaldata == null))
        {
            if (approvaldata.Length > 0)
            {
                approvallist.Length = 0;
                for (i = 0; i <= approvaldata.Length - 1; i++)
                {
                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/user.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user") + "\" title=\"" + m_refMsg.GetMessage("approver is user") + "\">");
                    }
                    else
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/users.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user group") + "\" title=\"" + m_refMsg.GetMessage("approver is user group") + "\">");
                    }
                    if (approvaldata[i].IsCurrentApprover)
                    {
                        approvallist.Append("<span class=\"important\">");
                    }
                    else
                    {
                        approvallist.Append("<span>");
                    }
                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }
                    else
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }
                    approvallist.Append("</span>");
                }
            }
        }
        dr[1] = approvallist.ToString();
        dt.Rows.Add(dr);

        if (folder_data == null)
        {
            folder_data = m_refContentApi.EkContentRef.GetFolderById(entry_edit_data.FolderId);
        }

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("template label");

        if (m_refContent.MultiConfigExists(entry_edit_data.Id, m_refContentApi.RequestInformationRef.ContentLanguage))
        {
            TemplateData t_templateData = m_refContent.GetMultiTemplateASPX(entry_edit_data.Id);
            if (t_templateData != null)
            {
                dr[1] = t_templateData.FileName;
            }
            else
            {
                dr[1] = folder_data.TemplateFileName;
            }
        }
        else
        {
            dr[1] = folder_data.TemplateFileName;
        }

        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic Path");
        dr[1] = data.Path;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("rating label");

        Collection dataCol = m_refContentApi.GetContentRatingStatistics(entry_edit_data.Id, 0, null);
        int total = 0;
        int sum = 0;
        int hits = 0;
        if (dataCol.Count > 0)
        {
            total = Convert.ToInt32 (dataCol["total"]);
            sum = Convert.ToInt32 (dataCol["sum"]);
            hits = Convert.ToInt32 (dataCol["hits"]);
        }

        if (total == 0)
        {
            dr[1] = m_refMsg.GetMessage("content not rated");
        }
        else
        {
            dr[1] = Math.Round(System.Convert.ToDouble(Convert.ToDouble((short)sum) / total), 2);
        }

        dt.Rows.Add(dr);

        //dr = dt.NewRow()
        //dr(0) = "Content Hits:"
        //dr(1) = hits

        //dt.Rows.Add(dr)

        dr = dt.NewRow();
        dr[0] = this.m_refMsg.GetMessage("lbl content searchable");
        dr[1] = data.IsSearchable.ToString();
        dt.Rows.Add(dr);

        DataView dv = new DataView(dt);
        PropertiesGrid.DataSource = dv;
        PropertiesGrid.DataBind();
    }
Example #45
0
    private void ViewToolBar()
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        string strAssetId = content_data.AssetData.Id;
        bool bIsAsset = false;
        Hashtable asset_info = new Hashtable();
        int i;
        bool folderIsHidden = m_refContentApi.IsFolderHidden(content_data.FolderId);

        bIsAsset = Utilities.IsAsset(content_data.Type, strAssetId);
        if (bIsAsset)
        {

            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                asset_info.Add(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i], "");
            }
            asset_info["AssetID"] = content_data.AssetData.Id; //(m_AssetInfoKeys(i))
            asset_info["AssetVersion"] = content_data.AssetData.Version;
            asset_info["AssetFilename"] = content_data.AssetData.FileName;
            asset_info["MimeType"] = content_data.AssetData.MimeType;
            asset_info["FileExtension"] = content_data.AssetData.FileExtension;
            asset_info["MimeName"] = content_data.AssetData.MimeName;
            asset_info["ImageUrl"] = content_data.AssetData.ImageUrl;

            //This code is used to pass the file name to the control to handle work-offline feature.
            if (content_data.AssetData.FileName.Trim() != "")
            {
                lblContentTitle.Text = content_data.AssetData.FileName;
            }
            else
            {
                lblContentTitle.Text = content_data.Title;
            }

            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                AssetHidden.Text += "<input type=\"hidden\" name=\"asset_" + Strings.LCase(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]) + "\" value=\"" + EkFunctions.HtmlEncode(asset_info[Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]].ToString()) + "\">";
            }
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "Tree/js/com.ektron.utils.string.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "Tree/js/com.ektron.utils.cookie.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "java/assetevents.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\">" + "\r\n";
            AssetHidden.Text += "setTimeout(\"SetTraceFormName()\",1);" + "\r\n";
            AssetHidden.Text += "function SetTraceFormName()" + "\r\n";
            AssetHidden.Text += "{" + "\r\n";
            AssetHidden.Text += "if (\"object\" == typeof g_AssetHandler)" + "\r\n";
            AssetHidden.Text += "{" + "\r\n";
            AssetHidden.Text += "g_AssetHandler.formName = \"frmContent\";" + "\r\n";
            AssetHidden.Text += "}" + "\r\n";
            AssetHidden.Text += "}" + "\r\n";
            AssetHidden.Text += "</script>";
        }

        if (m_strPageAction == "view" || m_strPageAction == "viewstaged")
        {
            string WorkareaTitlebarTitle = (string)(m_refMsg.GetMessage("view content title") + " \"" + content_data.Title + "\"");
            if (m_strPageAction == "viewstaged")
            {
                WorkareaTitlebarTitle = WorkareaTitlebarTitle + m_refMsg.GetMessage("staged version msg");
            }
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar(WorkareaTitlebarTitle);
        }

        result.Append("<table><tr>");

        if (!folderIsHidden)
        {
            if (Request.QueryString["callerpage"] == "dashboard.aspx")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:top.switchDesktopTab()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["callerpage"] != null)
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(AntiXss.UrlEncode(Request.QueryString["callerpage"]) + "?" + EkFunctions.HtmlEncode(Request.QueryString["origurl"]).Replace("&amp;", "&")), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["backpage"] == "history")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:history.back()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(EkFunctions.HtmlEncode("content.aspx?LangType=" + ContentLanguage + "&action=ViewContentByCategory&id=" + content_data.FolderId)), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
        }

        bool primaryCssClassApplied = false;

        if (security_data.CanEdit)
        {
            // Don't show edit button for Mac when using XML config:
            if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
            {
                if (content_data.Type == 3333)
                {
                    result.Append(m_refStyle.GetCatalogEditAnchor(m_intId, 3333, false, !primaryCssClassApplied));
                }
                else
                {
                    if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                    {
                        result.Append(m_refStyle.GetEditAnchor(m_intId, 1, false, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData, !primaryCssClassApplied)); // to be commented out
                    }
                    else
                    {
                        result.Append(m_refStyle.GetEditAnchor(m_intId, 1, false, EkEnumeration.CMSContentSubtype.Content, !primaryCssClassApplied)); // to be commented out
                    }

                    result.Append(m_refStyle.GetPageBuilderEditAnchor(m_intId, content_data, !primaryCssClassApplied));
                }

                primaryCssClassApplied = true;
            }
        }

        if (security_data.CanEdit)
        {
            if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || IsFolderAdmin())))
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/checkIn.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&content_type=" + content_data.Type), m_refMsg.GetMessage("alt checkin button text"), m_refMsg.GetMessage("btn checkin"), "", StyleHelper.CheckInButtonCssClass, !primaryCssClassApplied));

                primaryCssClassApplied = true;

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                }
            }
            else if (((content_data.Status == "I") || (content_data.Status == "T")) && (content_data.UserId == CurrentUserId))
            {
                if (security_data.CanPublish)
                {
                    bool metaRequuired = false;
                    bool categoryRequired = false;
                    bool manaliasRequired = false;
                    string msg = string.Empty;
                    m_refContentApi.EkContentRef.ValidateMetaDataTaxonomyAndAlias(content_data.FolderId, content_data.Id, content_data.LanguageId, ref metaRequuired, ref categoryRequired, ref manaliasRequired);
                    if (metaRequuired == false && categoryRequired == false && manaliasRequired == false)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentPublish.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt publish button text"), m_refMsg.GetMessage("btn publish"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"", StyleHelper.PublishButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        if (metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias and category required");
                        }
                        else if (metaRequuired && categoryRequired && !manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and category required");
                        }
                        else if (metaRequuired && !categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias required");
                        }
                        else if (!metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias and category required");
                        }
                        else if (metaRequuired)
                        {
                            msg = m_refMsg.GetMessage("validate meta required");
                        }
                        else if (manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias required");
                        }
                        else
                        {
                            msg = m_refMsg.GetMessage("validate category required");
                        }

                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentPublish.png", "#", m_refMsg.GetMessage("alt publish button text"), m_refMsg.GetMessage("btn publish"), "onclick=\"alert(\'" + msg + "\');\"", StyleHelper.PublishButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalSubmitFor.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt submit button text"), m_refMsg.GetMessage("btn submit"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"", StyleHelper.SubmitForApprovalButtonCssClass, !primaryCssClassApplied)); //TODO need to pass integer not boolean

                    primaryCssClassApplied = true;
                }

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                }
            }
            else if ((content_data.Status == "O") || (content_data.Status == "I") || (content_data.Status == "S") || (content_data.Status == "T") || (content_data.Status == "P"))
            {
                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass, !primaryCssClassApplied));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass, !primaryCssClassApplied));
                }

                primaryCssClassApplied = true;
            }
        }
        else
        {
            //NEW CODE IMPLEMENTATION ADDED BY UDAI On 06/16/05 FOR THE DEFECT#13694,13914
            //BEGIN
            if (content_data.Status == "S" || content_data.Status == "M")
            {
                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                string aPublishTagClass;

                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "../UI/Icons/contentPublish.png";
                    CaptionKey = "btn publish";
                    aPublishTagClass = StyleHelper.PublishButtonCssClass;
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "../UI/Icons/delete.png";
                    CaptionKey = "btn delete";
                    aPublishTagClass = StyleHelper.DeleteButtonCssClass;
                }

                if (security_data.CanPublish && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + PublishIcon, "#", AltPublishMsg, m_refMsg.GetMessage(CaptionKey), "Onclick=\"javascript:return LoadChildPage(\'action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", aPublishTagClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + PublishIcon, "content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "", AltPublishMsg, m_refMsg.GetMessage(CaptionKey), "", aPublishTagClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }
                else if (security_data.CanApprove && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalApproveItem.png", "#", AltApproveMsg, m_refMsg.GetMessage("btn approve"), "Onclick=\"javascript:return LoadChildPage(\'action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", StyleHelper.ApproveButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalApproveItem.png", "content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "", AltApproveMsg, m_refMsg.GetMessage("btn approve"), "", StyleHelper.ApproveButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }

                if ((security_data.CanPublish || security_data.CanApprove) && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "btn_decline-nm.gif", "#", AltDeclineMsg, m_refMsg.GetMessage("btn decline"), "Onclick=\"javascript:return LoadChildPage(\'action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", StyleHelper.DeclineButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "btn_decline-nm.gif", "javascript:DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')", AltDeclineMsg, m_refMsg.GetMessage("btn decline"), "", StyleHelper.DeclineButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }

                if (security_data.CanEditSumit)
                {
                    // Don't show edit button for Mac when using XML config:
                    if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
                    {
                        if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                        {
                            result.Append(m_refStyle.GetEditAnchor(m_intId, 1, true, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData, !primaryCssClassApplied));
                        }
                        else
                        {
                            result.Append(m_refStyle.GetEditAnchor(m_intId, 1, true, content_data.SubType, !primaryCssClassApplied));
                        }

                        primaryCssClassApplied = true;

                        result.Append(m_refStyle.GetPageBuilderEditAnchor(m_intId, content_data));
                    }
                }

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass, !primaryCssClassApplied));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass, !primaryCssClassApplied));
                }
                //End If
                //END
            }
            else
            {
                if ((content_data.Status == "O") && ((security_data.IsAdmin || IsFolderAdmin()) || (security_data.CanBreakPending)))
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/checkIn.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea" + "&content_type=" + content_data.Type), m_refMsg.GetMessage("alt checkin button text"), m_refMsg.GetMessage("btn checkin"), "onclick=\"DisplayHoldMsg(true);return true;\"", StyleHelper.CheckInButtonCssClass, true));

                    if (m_strPageAction == "view")
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                    }
                }
            }
        }

        if (security_data.CanHistory)
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/history.png", "#", m_refMsg.GetMessage("alt history button text"), m_refMsg.GetMessage("lbl generic history"), "onclick=\"top.document.getElementById(\'ek_main\').src=\'historyarea.aspx?action=report&LangType=" + ContentLanguage + "&id=" + m_intId + "\';return false;\"", StyleHelper.HistoryButtonCssClass));
        }

        if (security_data.CanDelete)
        {
            string href;
            href = (string)("content.aspx?LangType=" + ContentLanguage + "&action=submitDelContAction&delete_id=" + m_intId + "&page=" + Request.QueryString["calledfrom"] + "&folder_id=" + content_data.FolderId);
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/delete.png", "#", m_refMsg.GetMessage("alt delete button text"), m_refMsg.GetMessage("btn delete"), "onclick=\"DeleteConfirmationDialog(\'" + href + "\');return false;\" ", StyleHelper.DeleteButtonCssClass));
        }

        result.Append(StyleHelper.ActionBarDivider);

        if (content_data.Status != "A")
        {
            if (!((Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= content_data.Type) && (content_data.Type <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)))
            {
                if (content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewDifferences.png", "#", "View Difference", m_refMsg.GetMessage("btn view diff"), "onclick=\"PopEditWindow(\'compare.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\', \'Compare\', 785, 650, 1, 1);\"", StyleHelper.ViewDifferenceButtonCssClass));
                }
            }
        }

        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/permissions.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewPermissions&type=content&id=" + m_intId), m_refMsg.GetMessage("alt permissions button text content (view)"), m_refMsg.GetMessage("btn view permissions"), "", StyleHelper.ViewPermissionsButtonCssClass));
            if (!folderIsHidden)
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvals.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewApprovals&type=content&id=" + m_intId), m_refMsg.GetMessage("alt approvals button text content (view)"), m_refMsg.GetMessage("btn view approvals"), "", StyleHelper.ViewApprovalsButtonCssClass));
            }
        }
        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/linkSearch.png", (string)("isearch.aspx?LangType=" + ContentLanguage + "&action=dofindcontent&folderid=0&content_id=" + m_intId + ((content_data.AssetData.MimeType.IndexOf("image") != -1) ? "&asset_name=" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension : "")), m_refMsg.GetMessage("btn link search"), m_refMsg.GetMessage("btn link search"), "", StyleHelper.SearchButtonCssClass));

        result.Append(StyleHelper.ActionBarDivider);

        if (security_data.CanAddTask)
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/taskAdd.png", (string)("tasks.aspx?LangType=" + ContentLanguage + "&action=AddTask&cid=" + m_intId + "&callbackpage=content.aspx&parm1=action&value1=" + m_strPageAction + "&parm2=id&value2=" + m_intId + "&parm3=LangType&value3=" + ContentLanguage), m_refMsg.GetMessage("btn add task"), m_refMsg.GetMessage("btn add task"), "", StyleHelper.AddTaskButtonCssClass));
        }

        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/chartBar.png", (string)("ContentStatistics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId), m_refMsg.GetMessage("click view content reports"), m_refMsg.GetMessage("click view content reports"), "", StyleHelper.ViewReportButtonCssClass));
        string quicklinkUrl = SitePath + content_data.Quicklink;
        if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))
        {
            quicklinkUrl = m_refContentApi.RequestInformationRef.AssetPath + content_data.Quicklink;
        }
        else if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && SitePath != "/")
        {
            string appPathOnly = m_refContentApi.RequestInformationRef.ApplicationPath.Replace(SitePath, "");
            if (content_data.Quicklink.Contains(appPathOnly) || !content_data.Quicklink.Contains("downloadasset.aspx"))
            {
                quicklinkUrl = SitePath + ((content_data.Quicklink.StartsWith("/")) ? (content_data.Quicklink.Substring(1)) : content_data.Quicklink);
            }
            else
            {
                quicklinkUrl = m_refContentApi.RequestInformationRef.ApplicationPath + content_data.Quicklink;
            }
        }
        if (IsAnalyticsViewer() && ObjectFactory.GetAnalytics().HasProviders())
        {
            string modalUrl = string.Format("onclick=\"window.open(\'{0}/analytics/seo.aspx?tab=traffic&uri={1}\', \'Analytics400\', \'width=900,height=580,scrollable=1,resizable=1\');return false;\"", ApplicationPath, quicklinkUrl);
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/chartPie.png", "#", m_refMsg.GetMessage("lbl entry analytics"), m_refMsg.GetMessage("lbl entry analytics"), modalUrl, StyleHelper.ViewAnalyticsButtonCssClass));
        }

        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/properties.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=EditContentProperties&id=" + m_intId), m_refMsg.GetMessage("btn edit prop"), m_refMsg.GetMessage("btn edit prop"), "", StyleHelper.EditPropertiesButtonCssClass));
        }

        //Sync API needs to know folder type to display the eligible sync profiles.
        if (this.folder_data == null)
        {
            folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
        }

        SiteAPI site = new SiteAPI();
        EkSite ekSiteRef = site.EkSiteRef;
        if ((m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncAdmin) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncUser)) && (LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Feature.eSync)) && m_refContentApi.RequestInformationRef.IsSyncEnabled)
        {
            if ((m_strPageAction == "view") && (content_data.Status.ToUpper() == "A") && ServerInformation.IsStaged())
            {
                if (content_data.SubType != EkEnumeration.CMSContentSubtype.WebEvent)
                {
                    if (folder_data.IsDomainFolder)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "sync_now_data.png", "#", m_refMsg.GetMessage("alt sync content"), m_refMsg.GetMessage("btn sync content"), "OnClick=\"Ektron.Workarea.Sync.Relationships.ShowSyncConfigurations(" + ContentLanguage + "," + m_intId + ",\'" + content_data.AssetData.Id + "\',\'" + content_data.AssetData.Version + "\'," + content_data.FolderId + ",true);return false;\"", StyleHelper.SyncButtonCssClass));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "sync_now_data.png", "#", m_refMsg.GetMessage("alt sync content"), m_refMsg.GetMessage("btn sync content"), "OnClick=\"Ektron.Workarea.Sync.Relationships.ShowSyncConfigurations(" + ContentLanguage + "," + m_intId + ",\'" + content_data.AssetData.Id + "\',\'" + content_data.AssetData.Version + "\'," + content_data.FolderId + ",false);return false;\"", StyleHelper.SyncButtonCssClass));
                    }
                }
            }
        }

        if (EnableMultilingual == 1)
        {
            string strViewDisplay = "";
            string strAddDisplay = "";
            LanguageData[] result_language;
            int count = 0;

            if (security_data.CanEdit || security_data.CanEditSumit)
            {
                LocalizationObject l10nObj = new LocalizationObject();
                int sourceLanguageId;
                DateTime sourceDateModified;
                Ektron.Cms.Localization.LocalizationState locState = l10nObj.GetContentLocalizationState(m_intId, content_data, out sourceLanguageId, out sourceDateModified);
                if (-1 == sourceLanguageId) sourceLanguageId = ContentLanguage;

                bool addedTranslationDivider = false;

                if (m_refStyle.IsExportTranslationSupportedForContentType((EkEnumeration.CMSContentType)content_data.Type))
                {
                    var statusMenu = m_refStyle.GetTranslationStatusMenu(content_data, m_refMsg.GetMessage("alt click here to update this content translation status"), m_refMsg.GetMessage("lbl mark translation status"), locState);

                    if (!String.IsNullOrEmpty(statusMenu))
                    {
                        if (!addedTranslationDivider)
                        {
                            result.Append(StyleHelper.ActionBarDivider);
                            addedTranslationDivider = true;
                        }

                        result.Append(statusMenu);
                    }

                    var statusPopUpMenu = m_refStyle.PopupTranslationMenu(content_data, locState);

                    if (!String.IsNullOrEmpty(statusMenu))
                    {
                        if (!addedTranslationDivider)
                        {
                            result.Append(StyleHelper.ActionBarDivider);
                            addedTranslationDivider = true;
                        }

                        result.Append(statusPopUpMenu);
                    }

                    if (locState.IsExportableState())
                    {
                        var exportButton = m_refStyle.GetExportTranslationButton((string)("content.aspx?LangType=" + sourceLanguageId + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId), m_refMsg.GetMessage("alt Click here to export this content for translation"), m_refMsg.GetMessage("lbl Export for translation"));

                        if (!String.IsNullOrEmpty(exportButton))
                        {
                            if (!addedTranslationDivider)
                            {
                                result.Append(StyleHelper.ActionBarDivider);
                                addedTranslationDivider = true;
                            }

                            result.Append(exportButton);
                        }
                    }
                }
                if (System.Configuration.ConfigurationSettings.AppSettings["ek_ContentFallback"] != null && Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["ek_ContentFallback"]))
                {
                    if (!addedTranslationDivider)
                    {
                        result.Append(StyleHelper.ActionBarDivider);
                        addedTranslationDivider = true;
                    }

                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/listBullet.png", "localization/contentfallback.aspx?id=" + m_intId + "&folder_id=" + content_data.FolderId, m_refMsg.GetMessage("alt edit content fallback"), m_refMsg.GetMessage("alt edit content fallback"), "", StyleHelper.EditFallbackButtonCssClass));
                }
            }

            result_language = m_refContentApi.DisplayAddViewLanguage(m_intId);
            for (count = 0; count <= result_language.Length - 1; count++)
            {
                if (result_language[count].Type == "VIEW")
                {
                    if (content_data.LanguageId == result_language[count].Id)
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + " selected>" + result_language[count].Name + "</option>";
                    }
                    else
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
            }
            if (strViewDisplay != "")
            {
                result.Append(StyleHelper.ActionBarDivider);
                result.Append("<td class=\"label\">" + m_refMsg.GetMessage("view language") + "</td>");
                result.Append("<td>");
                result.Append("<select id=viewcontent name=viewcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'VIEW\');\">");
                result.Append(strViewDisplay);
                result.Append("</select>");
                result.Append("</td>");
            }
            if (security_data.CanAdd)
            {
                //If (bCanAddNewLanguage) Then
                for (count = 0; count <= result_language.Length - 1; count++)
                {
                    if (result_language[count].Type == "ADD")
                    {
                        strAddDisplay = strAddDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
                if (strAddDisplay != "")
                {
                    result.Append("<td>&nbsp;&nbsp;</td>");
                    result.Append("<td class=\"label\">" + m_refMsg.GetMessage("add title") + ":</td>");
                    result.Append("<td>");
                    if (folder_data == null)
                    {
                        folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
                    }
                    if (Utilities.IsNonFormattedContentAllowed(m_refContentApi.GetEnabledXmlConfigsByFolder(this.folder_data.Id)))
                    {
                        allowHtml = "&AllowHtml=1";
                    }
                    result.Append("<select id=addcontent name=addcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'ADD\');\">");
                    result.Append("<option value=" + "0" + ">" + "-select language-" + "</option>");
                    result.Append(strAddDisplay);
                    result.Append("</select></td>");
                }
                //End If
            }
        }

        result.Append(StyleHelper.ActionBarDivider);
        result.Append("<td>");
        if (m_strPageAction == "view")
        {
            result.Append(m_refStyle.GetHelpButton("Viewcontent", ""));
        }
        else if (m_strPageAction == "viewstaged")
        {
            result.Append(m_refStyle.GetHelpButton("Viewstaged", ""));
        }
        result.Append("</td>");
        result.Append("</tr>");
        result.Append("</table>");
        htmToolBar.InnerHtml = result.ToString();
    }
Example #46
0
    private void ViewMetaData(ContentData data)
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        string strResult = "";
        string strImagePath = "";
        FolderData fldr_Data = new FolderData();
        ContentAPI contentapi = new ContentAPI();

        fldr_Data = contentapi.GetFolderById(data.FolderId);
        if (data != null)
        {
            List<ContentMetaData> displayMetaDataList = new List<ContentMetaData>();
            for (int i = 0; i < data.MetaData.Length; i++)
            {
                string typeName = data.MetaData[i].TypeName;
                 if (!typeName.StartsWith("L10n", StringComparison.OrdinalIgnoreCase) && !typeName.StartsWith("Xliff", StringComparison.OrdinalIgnoreCase) && data.MetaData[i].Type.ToString() != "ImageSelector")
                {
                    displayMetaDataList.Add(data.MetaData[i]);
                }
                else if (data.MetaData[i].Type.ToString() == "ImageSelector")
                {
                    data.MetaData[i].Text = data.MetaData[i].Text.Replace(SitePath + "assets/", "");
                    data.MetaData[i].Text = System.Text.RegularExpressions.Regex.Replace(data.MetaData[i].Text, "\\?.*", "");
                    displayMetaDataList.Add(data.MetaData[i]);
                }
          }

            if (displayMetaDataList.Count > 0)
            {
                strResult = Ektron.Cms.CustomFields.WriteFilteredMetadataForView(displayMetaDataList.ToArray(), m_intFolderId, false).Trim();
            }

            strImagePath = data.Image;
            if (strImagePath.IndexOf(this.AppImgPath + "spacer.gif") != -1)
            {
                strImagePath = "";
            }

            //if ((fldr_Data.IsDomainFolder == true || fldr_Data.DomainProduction != "") && SitePath != "/")
            //{
            //    if (strImagePath.IndexOf("http://") != -1)
            //    {
            //        strImagePath = strImagePath.Substring(strImagePath.IndexOf("http://"));
            //        data.ImageThumbnail = data.ImageThumbnail.Substring(data.ImageThumbnail.IndexOf("http://"));
            //    }
            //    else
            //    {
            //        if (strImagePath != "")
            //        {
            //            strImagePath = strImagePath.Replace(SitePath, "");
            //            data.ImageThumbnail = data.ImageThumbnail.Replace(SitePath, "");
            //            strImagePath = (string)("http://" + fldr_Data.DomainProduction + "/" + strImagePath);
            //            data.ImageThumbnail = (string)("http://" + fldr_Data.DomainProduction + "/" + data.ImageThumbnail);
            //        }
            //    }
            //}
            //else if ((fldr_Data.IsDomainFolder == true || fldr_Data.DomainProduction != "") && SitePath == "/")
            //{

            //    if (strImagePath.IndexOf("http://") != -1)
            //    {
            //        strImagePath = strImagePath.Substring(strImagePath.IndexOf("http://"));
            //        data.ImageThumbnail = data.ImageThumbnail.Substring(data.ImageThumbnail.IndexOf("http://"));
            //    }
            //    else
            //    {
            //        if (strImagePath != "")
            //        {
            //            strImagePath = (string)("http://" + fldr_Data.DomainProduction + "/" + strImagePath.Substring(1));
            //            data.ImageThumbnail = (string)("http://" + fldr_Data.DomainProduction + "/" + data.ImageThumbnail.Substring(1));
            //        }
            //    }
            //}
            //else if (fldr_Data.IsDomainFolder == false && strImagePath.IndexOf("http://") != -1)
            //{
            //    if (strImagePath.IndexOf(SitePath) == 0)
            //    {
            //        strImagePath = Strings.Replace(strImagePath, SitePath, "", 1, 1, 0);
            //        data.ImageThumbnail = Strings.Replace(data.ImageThumbnail, SitePath, "", 1, 1, 0);
            //    }
            //}
            //strImagePath = strImagePath;//Strings.Replace(strImagePath, SitePath, "", 1, 1, 0);
            data.ImageThumbnail = data.ImageThumbnail;// Strings.Replace(data.ImageThumbnail, SitePath, "", 1, 1, 0);
            if (fldr_Data.FolderType != 9)
            {
                // display tag info for this library item
                System.Text.StringBuilder taghtml = new System.Text.StringBuilder();
                taghtml.Append("<fieldset style=\"margin:10px\">");
                taghtml.Append("<legend>" + m_refMsg.GetMessage("lbl personal tags") + "</legend>");
                taghtml.Append("<div style=\"height: 80px; overflow: auto;\" >");
                if (content_data.Id > 0)
                {
                    LocalizationAPI localizationApi = new LocalizationAPI();
                    TagData[] tdaUser;
                    tdaUser = (new Ektron.Cms.Community.TagsAPI()).GetTagsForObject(content_data.Id, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content, m_refContentApi.ContentLanguage);

                    if (tdaUser != null && tdaUser.Length > 0)
                    {

                        foreach (TagData td in tdaUser)
                        {
                            taghtml.Append("<input disabled=\"disabled\" checked=\"checked\" type=\"checkbox\" id=\"userPTagsCbx_" + td.Id.ToString() + "\" name=\"userPTagsCbx_" + td.Id.ToString() + "\" />&#160;");
                            taghtml.Append("<img src=\'" + localizationApi.GetFlagUrlByLanguageID(td.LanguageId) + "\' />");
                            taghtml.Append("&#160;" + td.Text + "<br />");
                        }
                    }
                    else
                    {
                        taghtml.Append(m_refMsg.GetMessage("lbl notagsselected"));
                    }
                }
                taghtml.Append("</div>");
                taghtml.Append("</fieldset>");
                strResult = strResult + taghtml.ToString();
                if (System.IO.Path.GetExtension(data.ImageThumbnail).ToLower().IndexOf(".gif") != -1 && data.ImageThumbnail.ToLower().IndexOf("spacer.gif") == -1)
                {

                    data.ImageThumbnail = data.ImageThumbnail.Replace(".gif", ".png");
                }

                strResult = strResult + "<fieldset style=\"margin:10px\"><legend>" + this.m_refMsg.GetMessage("lbl image data") + "</legend><table width=\"100%\"><tr><td class=\"info\" width=\"1%\" nowrap=\"true\" align=\"left\">" + this.m_refMsg.GetMessage("images label") + "</td><td width=\"99%\" align=\"left\">" + strImagePath + "</td></tr><tr><td class=\"info\" colomnspan=\"2\" align=\"left\"><img src=\"" + data.ImageThumbnail + "\" atl=\"Thumbnail\" /></td></tr></table></fieldset>";

            }
            if (strResult != "")
            {
                result.Append(strResult);
            }
            else
            {
                result.Append(this.m_refMsg.GetMessage("lbl nometadefined"));
            }
        }

        MetaDataValue.Text = result.ToString();
    }
Example #47
0
    //End: Task Type
    private void ViewContentProperties(ContentData data)
    {
        //GET PROPERTY: status
        string dataStatus = "";
        switch (data.Status.ToLower())
        {
            case "a":
                dataStatus = m_refMsg.GetMessage("status:Approved (Published)");
                break;
            case "o":
                dataStatus = m_refMsg.GetMessage("status:Checked Out");
                break;
            case "i":
                dataStatus = m_refMsg.GetMessage("status:Checked In");
                break;
            case "p":
                dataStatus = m_refMsg.GetMessage("status:Approved (PGLD)");
                break;
            case "m":
                dataStatus = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Deletion") + "</font>";
                break;
            case "s":
                dataStatus = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Approval") + "</font>";
                break;
            case "t":
                dataStatus = m_refMsg.GetMessage("status:Waiting Approval");
                break;
            case "d":
                dataStatus = "Deleted (Pending Start Date)";
                break;
        }

        //GET PROPERTY: start date
        string goLive;
        if (data.DisplayGoLive.Length == 0)
        {
            goLive = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            goLive = Ektron.Cms.Common.EkFunctions.FormatDisplayDate(data.DisplayGoLive, data.LanguageId);
        }

        //GET PROPERTY: end date
        string endDate;
        if (data.DisplayEndDate == "")
        {
            endDate = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            endDate = Ektron.Cms.Common.EkFunctions.FormatDisplayDate(data.DisplayEndDate, data.LanguageId);
        }

        //GET PROPERTY: action on end date
        string endDateActionTitle;
        if (data.DisplayEndDate.Length > 0)
        {
            if (data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_archive_display)
            {
                endDateActionTitle = m_refMsg.GetMessage("Archive display descrp");
            }
            else if (data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_refresh)
            {
                endDateActionTitle = m_refMsg.GetMessage("Refresh descrp");
            }
            else
            {
                endDateActionTitle = m_refMsg.GetMessage("Archive expire descrp");
            }
        }
        else
        {
            endDateActionTitle = m_refMsg.GetMessage("none specified msg");
        }

        //GET PROPERTY: approval method
        string apporvalMethod;
        if (data.ApprovalMethod == 1)
        {
            apporvalMethod = m_refMsg.GetMessage("display for force all approvers");
        }
        else
        {
            apporvalMethod = m_refMsg.GetMessage("display for do not force all approvers");
        }

        //GET PROPERTY: approvals
        System.Text.StringBuilder approvallist = new System.Text.StringBuilder();
        int i;
        if (approvaldata == null)
        {
            approvaldata = m_refContentApi.GetCurrentApprovalInfoByID(m_intId);
        }
        approvallist.Append(m_refMsg.GetMessage("none specified msg"));
        if (!(approvaldata == null))
        {
            if (approvaldata.Length > 0)
            {
                approvallist.Length = 0;
                for (i = 0; i <= approvaldata.Length - 1; i++)
                {
                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/user.png\" alt=\"" + m_refMsg.GetMessage("approver is user") + "\" title=\"" + m_refMsg.GetMessage("approver is user") + "\">");
                    }
                    else
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/users.png\" alt=\"" + m_refMsg.GetMessage("approver is user group") + "\" title=\"" + m_refMsg.GetMessage("approver is user group") + "\">");
                    }

                    approvallist.Append("<span");
                    if (approvaldata[i].IsCurrentApprover)
                    {
                        approvallist.Append(" class=\"important\"");
                    }
                    approvallist.Append(">");

                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }
                    else
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }

                    approvallist.Append("</span>");
                }
            }
        }

        //GET PROPERTY: smart form configuration
        string type;
        if (data.Type == 3333)
        {
            type = m_refMsg.GetMessage("lbl product type xml config");
        }
        else
        {
            type = m_refMsg.GetMessage("xml configuration label");
        }

        //GET PROPERTY: smart form title
        string typeValue;
        if (!(data.XmlConfiguration == null))
        {
            typeValue = (string)("&nbsp;" + data.XmlConfiguration.Title);
            xml_id = data.XmlConfiguration.Id;
        }
        else
        {
            typeValue = (string)(m_refMsg.GetMessage("none specified msg") + " " + m_refMsg.GetMessage("html content assumed"));
        }

        if (folder_data == null)
        {
            folder_data = m_refContentApi.EkContentRef.GetFolderById(content_data.FolderId);
        }

        //GET PROPERTY: template name
        string fileName;
        if (m_refContent.MultiConfigExists(content_data.Id, m_refContentApi.RequestInformationRef.ContentLanguage))
        {
            TemplateData t_templateData = m_refContent.GetMultiTemplateASPX(content_data.Id);
            if (t_templateData != null)
            {
                fileName = t_templateData.FileName;
            }
            else
            {
                fileName = folder_data.TemplateFileName;
            }
        }
        else
        {
            fileName = folder_data.TemplateFileName;
        }

        //GET PROPERTY: rating
        string rating;
        Collection dataCol = m_refContentApi.GetContentRatingStatistics(data.Id, 0, null);
        int total = 0;
        int sum = 0;
        int hits = 0;
        if (dataCol.Count > 0)
        {
            total = Convert.ToInt32 (dataCol["total"]);
            sum = Convert.ToInt32 (dataCol["sum"]);
            hits = Convert.ToInt32 (dataCol["hits"]);
        }
        if (total == 0)
        {
            rating = m_refMsg.GetMessage("content not rated");
        }
        else
        {
            rating = System.Convert.ToString(Math.Round(System.Convert.ToDouble(Convert.ToDouble((short)sum) / total), 2));
        }

        NameValueCollection contentPropertyValues = new NameValueCollection();
        contentPropertyValues.Add(m_refMsg.GetMessage("content title label"), data.Title);
        contentPropertyValues.Add(m_refMsg.GetMessage("content id label"), data.Id.ToString ());
        contentPropertyValues.Add(m_refMsg.GetMessage("content language label"), LanguageName);
        contentPropertyValues.Add(m_refMsg.GetMessage("content status label"), dataStatus);
        contentPropertyValues.Add(m_refMsg.GetMessage("content LUE label"), data.EditorFirstName + " " + data.EditorLastName);
        contentPropertyValues.Add(m_refMsg.GetMessage("content LED label"), Ektron.Cms.Common.EkFunctions.FormatDisplayDate(data.DisplayLastEditDate, data.LanguageId));
        contentPropertyValues.Add(m_refMsg.GetMessage("generic start date label"),(goLive == Ektron.Cms.Common.EkFunctions.FormatDisplayDate(DateTime.MinValue.ToString(), data.LanguageId) ? m_refMsg.GetMessage("none specified msg") : goLive ));
        contentPropertyValues.Add(m_refMsg.GetMessage("generic end date label"), (endDate == Ektron.Cms.Common.EkFunctions.FormatDisplayDate(DateTime.MinValue.ToString(),  data.LanguageId) ? m_refMsg.GetMessage("none specified msg") : endDate));
        contentPropertyValues.Add(m_refMsg.GetMessage("End Date Action Title"), endDateActionTitle);
        contentPropertyValues.Add(m_refMsg.GetMessage("content DC label"), Ektron.Cms.Common.EkFunctions.FormatDisplayDate(data.DateCreated.ToString(), data.LanguageId));
        contentPropertyValues.Add(m_refMsg.GetMessage("lbl approval method"), apporvalMethod);
        contentPropertyValues.Add(m_refMsg.GetMessage("content approvals label"), approvallist.ToString());
        if (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Content || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Forms)
        {
            contentPropertyValues.Add(type, typeValue);
        }
        if (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == 1 || content_data.Type == 2 || content_data.Type == 104)
        {
            contentPropertyValues.Add(m_refMsg.GetMessage("template label"), fileName);
        }
        contentPropertyValues.Add(m_refMsg.GetMessage("generic Path"), data.Path);
        contentPropertyValues.Add(m_refMsg.GetMessage("rating label"), rating);
        contentPropertyValues.Add(m_refMsg.GetMessage("lbl content searchable"), data.IsSearchable.ToString());

        //string[] endColon = new string[] { ":" };
        string endColon = ":";
        string propertyName;
        StringBuilder propertyRows = new StringBuilder();
        for (i = 0; i <= contentPropertyValues.Count - 1; i++)
        {
            propertyName = (string)(contentPropertyValues.GetKey(i).TrimEnd(endColon.ToString().ToCharArray()));
            propertyRows.Append("<tr><td class=\"label\">");
            propertyRows.Append(propertyName + ":");
            propertyRows.Append("</td><td>");
            propertyRows.Append(contentPropertyValues[contentPropertyValues.GetKey(i)]);
            propertyRows.Append("</td></tr>");
        }

        litPropertyRows.Text = propertyRows.ToString();
    }
Example #48
0
    private void PopulateFullAlias(string quicklink)
    {
        if (folderData == null)
        {
            folderData = contentAPI.GetFolderById(folderId);
        }
        string redirect = "";

        redirect = contentAPI.SitePath + quicklink;
        redirect += (redirect.Contains("?")) ? "&ektronPageBuilderEdit=true" : "?ektronPageBuilderEdit=true";

        fullAlias.Value = redirect;
    }
Example #49
0
    private void Display_EditPermissions()
    {
        long nFolderId;

        if (_ItemType == "folder")
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
            nFolderId = _Id;
            if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum))
            {
                _IsBoard = true;
            }
            else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog))
            {
                _IsBlog = true;
            }
        }
        else
        {
            _ContentData = _ContentApi.GetContentById(_Id, 0);
            _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId);
            nFolderId = _ContentData.FolderId;
        }
        EditPermissionsToolBar();
        _PageData = new Collection();
        UserPermissionData[] userpermission_data;
        UserGroupData usergroup_data;
        UserData user_data;
        UserAPI m_refUserAPI = new UserAPI();
        if (Request.QueryString["base"] == "group")
        {
            userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, 0, Request.QueryString["PermID"], ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All); //cTmp = ContObj.GetOrderedItemPermissionsv2_0(cTmp, retString)
            usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]));
            _IsMembership = usergroup_data.IsMemberShipGroup;
        }
        else
        {
            userpermission_data = _ContentApi.GetUserPermissions(_Id, _ItemType, Convert.ToInt64(Request.QueryString["PermID"]), "", ContentAPI.PermissionUserType.All, ContentAPI.PermissionRequestType.All);
            user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false);
            _IsMembership = user_data.IsMemberShip;

        }
        frm_itemid.Value = _Id.ToString();
        frm_type.Value = Request.QueryString["type"];
        frm_base.Value = _Base;
        frm_permid.Value = Request.QueryString["PermID"];
        frm_membership.Value = Request.QueryString["membership"];

        if (_IsMembership)
        {
            td_ep_membership.Visible = false;
            hmembershiptype.Value = "1";
        }
        else
        {
            td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt();
            hmembershiptype.Value = "0";
        }
        Populate_EditPermissionsGenericGrid(userpermission_data);
        Populate_EditPermissionsAdvancedGrid(userpermission_data);
    }
Example #50
0
    private void Process_DoUpdate()
    {
        string sTerms = "";
        if (Request.Form[hdn_adb_action.UniqueID] == "prop")
        {

            this._OldTemplateName = m_refContentApi.GetTemplatesByFolderId(m_iID).FileName;
            _DiscussionBoard.Id = m_iID;
            _DiscussionBoard.Name = (string)(Request.Form[txt_adb_boardname.UniqueID].Trim(".".ToCharArray()));
            _DiscussionBoard.Title = Request.Form[txt_adb_title.UniqueID];

            //BreadCrumb/SiteMapPath update.
            if ((Request.Form["hdnInheritSitemap"] != null) && (Request.Form["hdnInheritSitemap"].ToString().ToLower() == "true"))
            {
                _DiscussionBoard.SitemapInherited = Convert.ToInt32(true);
            }
            else
            {
                _DiscussionBoard.SitemapInherited = Convert.ToInt32(false);
                _DiscussionBoard.SitemapPath = Utilities.DeserializeSitemapPath(Request.Form, this.ContentLanguage);
            }

            _DiscussionBoard.AcceptedHTML = this.ProcessCSV(Request.Form[txt_acceptedhtml.UniqueID], "html");
            _DiscussionBoard.AcceptedExtensions = this.ProcessCSV(Request.Form[txt_acceptedextensions.UniqueID], "ext");

            if (Request.Form[chk_adb_mc.UniqueID] != null && Request.Form[chk_adb_mc.UniqueID] != "")
            {
                _DiscussionBoard.ModerateComments = true;
            }
            else
            {
                _DiscussionBoard.ModerateComments = false;
            }
            if (Request.Form[chk_adb_ra.UniqueID] != null && Request.Form[chk_adb_ra.UniqueID] != "")
            {
                _DiscussionBoard.RequireAuthentication = true;
            }
            else
            {
                _DiscussionBoard.RequireAuthentication = false;
            }
            if (Request.Form[chk_lock_board.UniqueID] != null && Request.Form[chk_lock_board.UniqueID] != "")
            {
                _DiscussionBoard.LockBoard = true;
            }
            else
            {
                _DiscussionBoard.LockBoard = false;
            }
            // handle dynamic replication properties
            if ((Request.Form[chk_repl.UniqueID] != null && Request.Form[chk_repl.UniqueID] != "") || (Request.Form["EnableReplication"] != null && Request.Form["EnableReplication"] == "1"))
            {
                _DiscussionBoard.ReplicationMethod = 1;
            }
            else
            {
                _DiscussionBoard.ReplicationMethod = 0;
            }
            sTerms = (string)_Editor.Content;
            if (!(Request.Form["content_html_action"] == null))
            {
                sTerms = Context.Server.HtmlDecode(sTerms);
            }
            _DiscussionBoard.TermsAndConditions = sTerms;
            _DiscussionBoard.StyleSheet = Request.Form[txt_adb_stylesheet.UniqueID];
            if (Information.IsNumeric(Request.Form[txt_maxfilesize.UniqueID]) && Convert.ToInt32(Request.Form[txt_maxfilesize.UniqueID]) > 0)
            {
                _DiscussionBoard.MaxFileSize = Convert.ToInt32(Request.Form[txt_maxfilesize.UniqueID]);
            }
            else
            {
                _DiscussionBoard.MaxFileSize = 0;
            }

            _DiscussionBoard.TaxonomyInherited = false;

            if ((Request.Form["CategoryRequired"] != null) && Request.Form["CategoryRequired"].ToString().ToLower() == "on")
            {
                _DiscussionBoard.CategoryRequired = true;
            }
            else
            {
                _DiscussionBoard.CategoryRequired = Convert.ToBoolean(Convert.ToInt32(Request.Form[parent_category_required.UniqueID]));
            }

            if (Request.Form["taxlist"] == null || Request.Form["taxlist"].Trim().Length == 0)
            {
                _DiscussionBoard.CategoryRequired = false;
            }

            string IdRequests = "";
            if ((Request.Form["taxlist"] != null) && Request.Form["taxlist"] != "")
            {
                IdRequests = Request.Form["taxlist"];
            }

            //dbBoard.TaxonomyInheritedFrom = Convert.ToInt32(Request.Form(inherit_taxonomy_from.UniqueID))
            if (_GroupID != -1)
            {
                _EkContentRef.UpdateBoard(_DiscussionBoard, _GroupID);
            }
            else
            {
                _DiscussionBoard = _EkContentRef.UpdateBoard(_DiscussionBoard);

            }

            FolderRequest folder_request = new FolderRequest();
            _FolderData = m_refContentApi.GetFolderById(m_iID);

            //@folderid int,
            //@foldername nvarchar(75),
            //@folderdescription nvarchar(255),
            //@stylesheet nvarchar(255),
            //@inheritmeta int,
            //@inheritmetafrom int,
            //@replicationflag int,
            //@productionhost nvarchar(510)='',
            //@staginghost nvarchar(510)='',
            //@inheritmetadata int,
            //@inheritmetadatafrom int,
            //@inherittaxonomy bit=0,
            //@inherittaxonomyfrom int=0,
            //@categoryrequired bit=0,
            //@catlanguage int=1033, ??
            //@catlist varchar(4000)=''

            folder_request.FolderId = _FolderData.Id;
            folder_request.FolderName = _FolderData.Name;
            folder_request.FolderDescription = _FolderData.Description;
            folder_request.StyleSheet = _FolderData.StyleSheet;
            folder_request.MetaInherited = _FolderData.MetaInherited;
            folder_request.MetaInheritedFrom = _FolderData.MetaInheritedFrom;
            //folder_request.EnableReplication = ??
            folder_request.DomainProduction = _FolderData.DomainProduction;
            folder_request.DomainStaging = _FolderData.DomainStaging;
            folder_request.MetaInherited = _FolderData.MetaInherited;
            folder_request.TaxonomyInherited = false;
            folder_request.TaxonomyInheritedFrom = _FolderData.MetaInheritedFrom;
            folder_request.CategoryRequired = _FolderData.CategoryRequired;

            //Updating Board folder with Sitemap information.
            folder_request.SiteMapPath = _DiscussionBoard.SitemapPath;
            folder_request.SiteMapPathInherit = System.Convert.ToBoolean(_DiscussionBoard.SitemapInherited);
            //catlanguage ??
            folder_request.TaxonomyIdList = IdRequests;
            if (_GroupID != -1)
            {
                m_refContentApi.UpdateBoardForumFolder(folder_request, _GroupID);
            }
            else
            {
                m_refContentApi.UpdateFolder(folder_request);
            }

            ProcessContentTemplatesPostBack();
            if (usesModal)
            {
                Response.Redirect(m_refContentApi.ApplicationPath + "CloseThickbox.aspx", false);
            }
            else if (Request.Form[hdn_adb_boardname.UniqueID] == Request.Form[txt_adb_boardname.UniqueID])
            {
                Response.Redirect((string)("addeditboard.aspx?action=View&id=" + _DiscussionBoard.Id.ToString()), false);
            }
            else
            {
                Response.Redirect("../content.aspx?TreeUpdated=1&LangType=" + ContentLanguage + "&action=ViewBoard&id=" + m_iID.ToString() + "&reloadtrees=Forms,Content,Library", false);
            }

            //If Not (Request.Form("suppress_notification") <> "") Then
            //    m_refcontent.UpdateSubscriptionPropertiesForFolder(m_intFolderId, sub_prop_data)
            //    m_refcontent.UpdateSubscriptionsForFolder(m_intFolderId, page_subscription_data)
            //End If

        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "cat")
        {
            Ektron.Cms.DiscussionCategory[] acCat = new DiscussionCategory[1];
            acCat[0] = new Ektron.Cms.DiscussionCategory();
            acCat[0].BoardID = m_iID;
            acCat[0].CategoryID = _CategoryId;
            acCat[0].Name = Request.Form[txt_catname.UniqueID];
            acCat[0].SetSortOrder(Convert.ToInt32(Request.Form[txt_catsort.UniqueID]));

            _EkContentRef.UpdateCategory(acCat);

            if (usesModal)
            {
                Response.Redirect("addeditboard.aspx?action=View&id=" + m_iID.ToString() + "&thickbox=true", false);
            }
            else
            {
                Response.Redirect("addeditboard.aspx?action=View&id=" + m_iID.ToString(), false);
            }

        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "addcat")
        {
            Ektron.Cms.DiscussionCategory[] acCat = new DiscussionCategory[1];
            acCat[0] = new Ektron.Cms.DiscussionCategory();
            acCat[0].BoardID = m_iID;
            acCat[0].CategoryID = 0;
            acCat[0].Name = Request.Form[txt_catname.UniqueID];
            acCat[0].SetSortOrder(Convert.ToInt32(Request.Form[txt_catsort.UniqueID]));

            _EkContentRef.AddCategoryforBoard(acCat);

            Response.Redirect((string)("../content.aspx?action=ViewContentByCategory&id=" + m_iID.ToString()), false);
        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "delcat")
        {
            _EkContentRef.DeleteBoardCategory(_CategoryId, Convert.ToInt64(Request.Form[drp_movecat.UniqueID]));
            Response.Redirect((string)("addeditboard.aspx?action=View&id=" + m_iID.ToString()), false);
        }
    }
Example #51
0
    private bool CurrentUserHasPermission(FolderData folder)
    {
        bool hasPermission = true;

        PermissionData folderPermissions = contentAPI.LoadPermissions(
            folder.Id,
            "folder",
            ContentAPI.PermissionResultType.All);

        if (!folderPermissions.IsAdmin && !folderPermissions.CanAdd)
        {
            hasPermission = false;
        }

        return hasPermission;
    }
        public static bool CreateFolder(MappingInfo mapping, string title, string tcmContainer)
        {
            if (!EnsureValidClient(mapping))
                return false;

            try
            {
                FolderData folderData = new FolderData
                {
                    Title = title,
                    LocationInfo = new LocationInfo { OrganizationalItem = new LinkToOrganizationalItemData { IdRef = tcmContainer } },
                    Id = "tcm:0-0-0"
                };

                folderData = Client.Save(folderData, new ReadOptions()) as FolderData;
                if (folderData == null)
                    return false;

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
Example #53
0
    private void Display_EditApprovals()
    {
        _PermissionData = _ContentApi.LoadPermissions(_Id, _ItemType, 0);

            int m_intApprovalMethoad = 0;
            if (_ItemType == "folder")
            {
                _FolderData = _ContentApi.GetFolderById(_Id);
                m_intApprovalMethoad = _FolderData.ApprovalMethod;
            }
            else
            {
                _ContentData = _ContentApi.GetContentById(_Id, 0);
                m_intApprovalMethoad = _ContentData.ApprovalMethod;
            }
            EditApprovalsToolBar();
            rblApprovalMethod.Items.Add(new ListItem(_MessageHelper.GetMessage("force all approvers with description"), "1"));
            rblApprovalMethod.Items.Add(new ListItem(_MessageHelper.GetMessage("do not force all approvers with description"), "0"));
            if (m_intApprovalMethoad == 1)
            {
                rblApprovalMethod.Items[0].Selected = true;
            }
            else
            {
                rblApprovalMethod.Items[1].Selected = true;
            }
    }
Example #54
0
    private void ViewCatalogToolBar()
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        if (content_data == null)
        {
            content_data = m_refContentApi.GetContentById(m_intId, 0);
        }
        long ParentId = content_data.FolderId;
        Ektron.Cms.Commerce.ProductType pProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef);
        int count = 0;
        int lAddMultiType = 0;
        bool bSelectedFound = false;
        bool bViewContent = System.Convert.ToBoolean("view" == m_strPageAction); // alternative is archived content
        string SRC = "";
        string str;
        string backStr;
        bool bFromApproval = false;
        int type = 3333;
        bool folderIsHidden = m_refContentApi.IsFolderHidden(content_data.FolderId);
        bool IsOrdered = m_refContentApi.EkContentRef.IsOrdered(content_data.Id);

        if (type == 1)
        {
            if (bFromApproval)
            {
                backStr = "back_file=approval.aspx";
            }
            else
            {
                backStr = "back_file=content.aspx";
            }
        }
        else
        {
            backStr = "back_file=cmsform.aspx";
        }
        str = Request.QueryString["action"];
        if (str != null && str.Length > 0)
        {
            backStr = backStr + "&back_action=" + str;
        }

        if (bFromApproval)
        {
            str = Request.QueryString["page"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_page=" + str;
            }
        }

        if (!bFromApproval)
        {
            str = Request.QueryString["folder_id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_folder_id=" + str;
            }
        }

        if (type == 1)
        {
            str = Request.QueryString["id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_id=" + str;
            }
        }
        else
        {
            str = Request.QueryString["form_id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_form_id=" + str;
            }
        }
        if (!(Request.QueryString["callerpage"] == null))
        {
            str = AntiXss.UrlEncode(Request.QueryString["callerpage"]);
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_callerpage=" + str;
            }
        }
        if (!(Request.QueryString["origurl"] == null))
        {
            str = Request.QueryString["origurl"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_origurl=" + EkFunctions.UrlEncode(str);
            }
        }
        str = ContentLanguage.ToString();
        if (str != null && str.Length > 0)
        {
            backStr = backStr + "&back_LangType=" + str + "&rnd=" + System.Convert.ToInt32(Conversion.Int((10 * VBMath.Rnd()) + 1));
        }

        SRC = (string)("commerce/catalogentry.aspx?close=false&LangType=" + ContentLanguage + "&id=" + m_intId + "&type=update&" + backStr);
        if (bFromApproval)
        {
            SRC += "&pullapproval=true";
        }

        if (m_strPageAction == "view" || m_strPageAction == "viewstaged")
        {
            string WorkareaTitlebarTitle = (string)(m_refMsg.GetMessage("lbl view catalog entry") + " \"" + content_data.Title + "\" ");
            if (m_strPageAction == "viewstaged")
            {
                WorkareaTitlebarTitle = WorkareaTitlebarTitle + m_refMsg.GetMessage("staged version msg");
            }
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar(WorkareaTitlebarTitle);
        }

        result.Append("<table><tr>" + "\r\n");
        if ((security_data.CanAdd && bViewContent) || security_data.IsReadOnly == true)
        {

            if (security_data.CanAdd && bViewContent)
            {
                if (!bSelectedFound)
                {
                    lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes;
                }
            }
        }

        SetViewImage("");

        if (!folderIsHidden && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //hiding the move button for pagebuilder type.
        {
            if (Request.QueryString["callerpage"] == "dashboard.aspx")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:top.switchDesktopTab()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (!String.IsNullOrEmpty(Request.QueryString["callerpage"]))
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(Request.QueryString["callerpage"] + "?" + HttpUtility.UrlDecode(Request.QueryString["origurl"])), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["backpage"] == "history")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:history.back()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewContentByCategory&id=" + content_data.FolderId), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
        }

        string buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"action\">" + m_refMsg.GetMessage("lbl Action") + "</span></td>");

        if ((security_data.CanAdd) || security_data.IsReadOnly)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"folderView\">" + m_refMsg.GetMessage("lbl View") + "</span></td>");
        }

        buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"chartBar\">" + m_refMsg.GetMessage("generic reports title") + "</span></td>");

        StringBuilder localizationMenuOptions = new StringBuilder();
        if (EnableMultilingual == 1)
        {
            string strViewDisplay = "";
            string strAddDisplay = "";
            LanguageData[] result_language;

            if (security_data.CanEdit || security_data.CanEditSumit)
            {
                LocalizationObject l10nObj = new LocalizationObject();
                Ektron.Cms.Localization.LocalizationState locState = l10nObj.GetContentLocalizationState(m_intId, content_data);
                if (m_refStyle.IsExportTranslationSupportedForContentType((EkEnumeration.CMSContentType)content_data.Type))
                {
                    string statusIcon = "";
                    string statusMsg = "";
                    m_refStyle.GetTranslationStatusIconAndMessage(locState, ref statusIcon, ref statusMsg);
                    // localizationMenuOptions.Append("    {0}.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + statusIcon + " \' />&nbsp;&nbsp;" + statusMsg + "\", function() { return false; } );" + Environment.NewLine);
                    // result.Append(m_refStyle.GetTranslationStatusMenu(content_data, m_refMsg.GetMessage("alt click here to update this content translation status"), m_refMsg.GetMessage("lbl mark ready for translation"), locState));
                    localizationMenuOptions.Append(m_refStyle.PopupTranslationMenu(content_data, locState, "actionmenu", statusMsg, statusIcon, false));
                    // result.Append(m_refStyle.PopupTranslationMenu(content_data, locState));

                    if (locState.IsExportableState())
                    {
                        localizationMenuOptions.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + m_refContentApi.AppPath + "images/UI/Icons/translation.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl Export for translation") + "\", function() { window.location.href=\"" + "content.aspx?LangType=" + ContentLanguage + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId + "\"; } );" + Environment.NewLine);
                        // result.Append(m_refStyle.GetExportTranslationButton((string)("content.aspx?LangType=" + ContentLanguage + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId), m_refMsg.GetMessage("alt Click here to export this content for translation"), m_refMsg.GetMessage("lbl Export for translation")));
                    }
                }
            }

            result_language = m_refContentApi.DisplayAddViewLanguage(m_intId);
            for (count = 0; count <= result_language.Length - 1; count++)
            {
                if (result_language[count].Type == "VIEW")
                {
                    if (content_data.LanguageId == result_language[count].Id)
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + " selected>" + result_language[count].Name + "</option>";
                    }
                    else
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
            }

            bool languageDividerAdded = false;

            if (strViewDisplay != "")
            {
                result.Append(StyleHelper.ActionBarDivider);
                languageDividerAdded = true;
                result.Append("<td nowrap=\"true\">" + m_refMsg.GetMessage("lbl View") + ":");
                result.Append("<select id=viewcontent name=viewcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'VIEW\');\">");
                result.Append(strViewDisplay);
                result.Append("</select></td>");
            }
            if (security_data.CanAdd)
            {
                //If (bCanAddNewLanguage) Then
                for (count = 0; count <= result_language.Length - 1; count++)
                {
                    if (result_language[count].Type == "ADD")
                    {
                        strAddDisplay = strAddDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
                if (strAddDisplay != "")
                {
                    if (!languageDividerAdded)
                    {
                        result.Append(StyleHelper.ActionBarDivider);
                    }
                    else
                    {
                        result.Append("<td>&nbsp;&nbsp;</td>");
                    }
                    result.Append("<td class=\"label\">" + m_refMsg.GetMessage("add title") + ":");
                    if (folder_data == null)
                    {
                        folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
                    }
                    if (Utilities.IsNonFormattedContentAllowed(m_refContentApi.GetEnabledXmlConfigsByFolder(this.folder_data.Id)))
                    {
                        allowHtml = "&AllowHtml=1";
                    }
                    result.Append("<select id=addcontent name=addcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'ADD\');\">");
                    result.Append("<option value=" + "0" + ">" + "-select language-" + "</option>");
                    result.Append(strAddDisplay);
                    result.Append("</select></td>");
                }
                //End If
            }

            //End If
        }

        bool canAddAssets = System.Convert.ToBoolean((security_data.CanAdd || security_data.CanAddFolders) && bViewContent);

        result.Append(StyleHelper.ActionBarDivider);
        result.Append("<td>");
        result.Append(m_refStyle.GetHelpButton(m_strPageAction, ""));
        result.Append("</td>");
        result.Append("</tr></table>");

        result.Append("<script language=\"javascript\">" + Environment.NewLine);

        result.Append("    var filemenu = new Menu( \"file\" );" + Environment.NewLine);
        if (security_data.CanAddFolders)
        {
            result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/folderGreen.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl commerce catalog") + "\", function() { window.location.href = \'content.aspx?LangType=" + ContentLanguage + "&action=AddSubFolder&type=catalog&id=" + m_intId + "\' } );" + Environment.NewLine);
            result.Append("    filemenu.addBreak();" + Environment.NewLine);
        }

        if (security_data.IsCollections || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AminCollectionMenu) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminCollection))
        {
            result.Append("" + Environment.NewLine);
        }
        result.Append("    var viewmenu = new Menu( \"view\" );" + Environment.NewLine);
        if (security_data.CanHistory)
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/history.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl content history"), 98) + "\", function() { top.document.getElementById(\'ek_main\').src=\"historyarea.aspx?action=report&LangType=" + ContentLanguage + "&id=" + m_intId + "\";return false;});" + Environment.NewLine);
        }
        if (content_data.Status != "A")
        {
            if (!((Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= content_data.Type) && (content_data.Type <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)))
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/contentViewDifferences.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view diff"), 98) + "\", function() { PopEditWindow(\'compare.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\', \'Compare\', 785, 500, 1, 1); } );" + Environment.NewLine);
            }
        }
        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/approvals.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view approvals"), 98) + "\", function() { location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewApprovals&type=content&id=" + m_intId + "\";} );" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/permissions.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view permissions"), 98) + "\", function() { location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewPermissions&type=content&id=" + m_intId + "\";} );" + Environment.NewLine);
        }
        result.Append("    viewmenu.addBreak();" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/brickLeftRight.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl cross sell"), 98) + "\", function() { location.href = \"commerce/recommendations/recommendations.aspx?action=crosssell&folder=" + m_intFolderId + "&id=" + m_intId + "\";} );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/brickUp.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl up sell"), Ektron.Cms.Common.EkConstants.CMSContentType_Content) + "\", function() { location.href = \"commerce/recommendations/recommendations.aspx?action=upsell&folder=" + m_intFolderId + "&id=" + m_intId + "\";} );" + Environment.NewLine);
        if ((security_data.CanEditFolders && bViewContent) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))
        {
            result.Append("    viewmenu.addBreak();" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/properties.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn properties"), Ektron.Cms.Common.EkConstants.CMSContentType_Content) + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=EditContentProperties&id=" + m_intId + "\";} );" + Environment.NewLine);
        }

        if (((security_data.CanAdd) && bViewContent) || security_data.IsReadOnly == true)
        {
            if (!(asset_data == null))
            {
                if (asset_data.Length > 0)
                {
                    for (count = 0; count <= asset_data.Length - 1; count++)
                    {
                        if (Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= asset_data[count].TypeId && asset_data[count].TypeId <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)
                        {
                            if ("*" == asset_data[count].PluginType)
                            {
                                lAddMultiType = asset_data[count].TypeId;
                            }
                            else
                            {
                                string imgsrc = string.Empty;
                                string txtCommName = string.Empty;
                                if (asset_data[count].TypeId == 101)
                                {
                                    imgsrc = "&nbsp;<img src=\'" + "images/UI/Icons/FileTypes/word.png" + "\' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Office Documents");
                                }
                                else if (asset_data[count].TypeId == 102 || asset_data[count].TypeId == 106)
                                {
                                    imgsrc = "&nbsp;<img valign=\'center\' src=\'" + "images/UI/Icons/contentHtml.png" + " \' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Managed Files");
                                }
                                else if (asset_data[count].TypeId == 104)
                                {
                                    imgsrc = "&nbsp;<img valign=\'center\' src=\'" + "images/UI/Icons/film.png" + " \' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Multimedia");
                                }
                                else
                                {
                                    imgsrc = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                }
                                if (asset_data[count].TypeId != 105)
                                {
                                    result.Append("viewmenu.addItem(\"" + imgsrc + "" + MakeBold(txtCommName, System.Convert.ToInt32(asset_data[count].TypeId)) + "\", function() { UpdateView(" + asset_data[count].TypeId + "); } );" + Environment.NewLine);
                                }
                            }
                        }
                    }
                }
            }

            result.Append("    MenuUtil.add( viewmenu );" + Environment.NewLine);

            result.Append("    var deletemenu = new Menu( \"delete\" );" + Environment.NewLine);
            result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/chartBar.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("content stats") + "\", function() { location.href = \"ContentStatistics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\";} );" + Environment.NewLine);
            result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/chartPie.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl entry reports") + "\", function() { location.href = \"Commerce/reporting/analytics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\";} );" + Environment.NewLine);
            string quicklinkUrl = SitePath + content_data.Quicklink;
            if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))
            {
                quicklinkUrl = m_refContentApi.RequestInformationRef.AssetPath + content_data.Quicklink;
            }
            else if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && SitePath != "/")
            {
                string appPathOnly = m_refContentApi.RequestInformationRef.ApplicationPath.Replace(SitePath, "");
                if (content_data.Quicklink.Contains(appPathOnly) || !content_data.Quicklink.Contains("downloadasset.aspx"))
                {
                    quicklinkUrl = SitePath + ((content_data.Quicklink.StartsWith("/")) ? (content_data.Quicklink.Substring(1)) : content_data.Quicklink);
                }
                else
                {
                    quicklinkUrl = m_refContentApi.RequestInformationRef.ApplicationPath + content_data.Quicklink;
                }
            }
            if (IsAnalyticsViewer() && ObjectFactory.GetAnalytics().HasProviders())
            {
                string modalUrl = string.Format("window.open(\"{0}/analytics/seo.aspx?tab=traffic&uri={1}\", \"Analytics400\", \"width=900,height=580,scrollable=1,resizable=1\");", ApplicationPath, quicklinkUrl);
                result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/chartBar.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl entry analytics") + "\", function() { " + modalUrl + " } );" + Environment.NewLine);
            }
            result.Append("    MenuUtil.add( deletemenu );" + Environment.NewLine);
        }

        result.Append("    var actionmenu = new Menu( \"action\" );" + Environment.NewLine);
        if (security_data.CanEdit && (content_data.Status != "S" && content_data.Status != "O" || (content_data.Status == "O" && content_state_data.CurrentUserId == CurrentUserId)))
        {
            result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentEdit.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn edit") + "\", function() { javascript:top.document.getElementById(\'ek_main\').src=\'" + SRC + "\';return false;\"" + ",\'EDIT\',790,580,1,1);return false;" + "\" ; } );" + Environment.NewLine);
        }

        if (security_data.CanDelete)
        {
            string href;
            href = (string)("content.aspx?LangType=" + ContentLanguage + "&action=submitDelCatalogAction&delete_id=" + m_intId + "&page=" + Request.QueryString["calledfrom"] + "&folder_id=" + content_data.FolderId);
            if (!IsOrdered)
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/delete.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn delete") + ("\", function() { DeleteConfirmationDialog(\'" + href) + "\');return false;} );" + Environment.NewLine);
            }
        }

        if (security_data.CanEdit)
        {

            if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || IsFolderAdmin())))
            {
                if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))))
                {

                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/checkIn.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn checkin") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&content_type=" + content_data.Type + "\" ; } );" + Environment.NewLine);

                }
                else if (IsFolderAdmin())
                {

                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/lockEdit.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl take ownership") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=TakeOwnerShip&id=" + m_intId + "&content_type=" + content_data.Type + "\" ; } );" + Environment.NewLine);

                }

                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
            }
            else if (((content_data.Status == "I") || (content_data.Status == "T")) && (content_data.UserId == CurrentUserId))
            {
                if (security_data.CanPublish)
                {
                    bool metaRequuired = false;
                    bool categoryRequired = false;
                    bool manaliasRequired = false;
                    string msg = string.Empty;
                    m_refContentApi.EkContentRef.ValidateMetaDataTaxonomyAndAlias(content_data.FolderId, content_data.Id, content_data.LanguageId, ref metaRequuired, ref categoryRequired, ref manaliasRequired);
                    if (metaRequuired == false && categoryRequired == false && manaliasRequired == false)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/application/commerce/submit.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn publish") + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "\" ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        if (metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias and category required");
                        }
                        else if (metaRequuired && categoryRequired && !manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and category required");
                        }
                        else if (metaRequuired && !categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias required");
                        }
                        else if (!metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias and category required");
                        }
                        else if (metaRequuired)
                        {
                            msg = m_refMsg.GetMessage("validate meta required");
                        }
                        else if (manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias required");
                        }
                        else
                        {
                            msg = m_refMsg.GetMessage("validate category required");
                        }
                        result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\' src=\'" + "images/application/commerce/submit.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn publish") + "\", function() { DisplayHoldMsg(true); window.location.href = \"alert(\'" + msg + "\')\"" + "; } );" + Environment.NewLine);
                    }
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalSubmitFor.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt submit button text"), m_refMsg.GetMessage("btn submit"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"")); //TODO need to pass integer not boolean
                }
                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
            }
            else if ((content_data.Status == "O") || (content_data.Status == "I") || (content_data.Status == "S") || (content_data.Status == "T") || (content_data.Status == "P"))
            {

                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
            }

            if (content_data.Status == "S" || content_data.Status == "M")
            {

                Util_CheckIsCurrentApprover(CurrentUserId);

                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "commerce/submit.gif";
                    CaptionKey = "btn publish";
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "../UI/Icons/delete.png";
                    CaptionKey = "btn delete";
                }
                if (security_data.CanPublish && IsLastApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } } );" + Environment.NewLine);
                    }
                }
                else if (security_data.CanApprove && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } );" + Environment.NewLine);
                    }
                }
                if ((security_data.CanPublish || security_data.CanApprove) && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { window.location.href = (\'content.aspx?action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')" + " ; } );" + Environment.NewLine);
                    }
                }
            }
        }
        else
        {
            if (content_data.Status == "S" || content_data.Status == "M")
            {
                Util_CheckIsCurrentApprover(CurrentUserId);

                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "commerce/submit.gif";
                    CaptionKey = "btn publish";
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "commerce/ApproveDelete.png";
                    CaptionKey = "approvals:lbl publish msg (delete)";
                }
                if (security_data.CanPublish && IsLastApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } } );" + Environment.NewLine);
                    }
                }
                else if (security_data.CanApprove && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } );" + Environment.NewLine);
                    }
                }
                if ((security_data.CanPublish || security_data.CanApprove) && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { window.location.href = (\'content.aspx?action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')" + " ; } );" + Environment.NewLine);
                    }
                }
                if (security_data.CanEditSumit)
                {
                    // Don't show edit button for Mac when using XML config:
                    if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
                    {
                        // result.Append(m_refStyle.GetEditAnchor(m_intId, , True))
                    }
                }
                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
                //End If
                //END
            }
            else
            {
                if ((content_data.Status == "O") && ((security_data.IsAdmin || IsFolderAdmin()) || (security_data.CanBreakPending)))
                {
                    if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))))
                    {

                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/checkIn.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn checkin") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea" + "&content_type=" + content_data.Type + "\" ; \"DisplayHoldMsg(true);return true;\"" + " } );" + Environment.NewLine);

                    }

                    if (m_strPageAction == "view")
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\'  src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                    }
                }
            }
        }
        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/linkSearch.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn link search") + "\", function() { window.location.href = \"isearch.aspx?LangType=" + ContentLanguage + "&action=dofindcontent&folderid=0&content_id=" + m_intId + ((content_data.AssetData.MimeType.IndexOf("image") != -1) ? "&asset_name=" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension : "") + "\" ; } );" + Environment.NewLine);
        if (security_data.CanAddTask)
        {
            result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/taskAdd.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn add task") + "\", function() { window.location.href = \"tasks.aspx?LangType=" + ContentLanguage + "&action=AddTask&cid=" + m_intId + "&callbackpage=content.aspx&parm1=action&value1=" + m_strPageAction + "&parm2=id&value2=" + m_intId + "&parm3=LangType&value3=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
        }
        if (localizationMenuOptions.Length > 0)
        {
            result.Append("    actionmenu.addBreak();" + Environment.NewLine);
            result.Append(localizationMenuOptions);
        }
        result.Append("    MenuUtil.add( actionmenu );" + Environment.NewLine);
        result.Append("    </script>" + Environment.NewLine);
        result.Append("" + Environment.NewLine);
        htmToolBar.InnerHtml = result.ToString();
    }
Example #55
0
    private void Display_AddApproval()
    {
        security_data = m_refContentApi.LoadPermissions(m_intId, ItemType, 0);

            if (ItemType == "folder")
            {
                folder_data = m_refContentApi.GetFolderById(m_intId);
            }
            else
            {
                content_data = m_refContentApi.GetContentById(m_intId, 0);
            }
            ApprovalData[] approval_data;
            approval_data = m_refContentApi.GetAllUnassignedItemApprovals(m_intId, ItemType);
            AddApprovalToolBar();
            Populate_AddApprovals(approval_data);
    }
Example #56
0
 public void Process_AddEdit()
 {
     ArrayList alTmp = new ArrayList();
     FolderData fdTmp;
     if (this.m_iID > 0)
     {
         aRestricted = cContent.SelectRestrictedIP(this.m_iID);
         riRestrict = aRestricted[0];
     }
     else
     {
         riRestrict = new RestrictedIP();
     }
     riRestrict.IPMask = Request.Form[txt_mask.UniqueID];
     if (m_iBoardID > 0)
     {
         riRestrict.AppliesTo = (FolderData[])Array.CreateInstance(typeof(FolderData), 1);
         riRestrict.AppliesTo[0] = new FolderData();
         riRestrict.AppliesTo[0].Id = this.m_iBoardID;
     }
     else
     {
         for (int i = 0; i <= (cl_boards.Items.Count - 1); i++)
         {
             if (cl_boards.Items[i].Selected == true)
             {
                 fdTmp = new FolderData();
                 fdTmp.Id = Convert.ToInt64(cl_boards.Items[i].Value);
                 alTmp.Add(fdTmp);
             }
         }
         riRestrict.AppliesTo = (FolderData[])alTmp.ToArray(typeof(FolderData));
     }
     if (this.m_iID > 0) // edit
     {
         if (m_iBoardID > 0)
         {
             riRestrict = cContent.UpdateRestrictedIP(riRestrict, this.m_iBoardID);
         }
         else
         {
             riRestrict = cContent.AddEditRestrictedIP(riRestrict);
         }
         Response.Redirect((string)("restrictIP.aspx?boardid=" + this.m_iBoardID.ToString() + "&action=view&id=" + this.m_iID.ToString()), false);
     }
     else // add
     {
         riRestrict = cContent.AddEditRestrictedIP(riRestrict);
         Response.Redirect((string)("restrictIP.aspx?boardid=" + this.m_iBoardID.ToString()), false);
     }
 }
Example #57
0
    /// <summary>
    /// Generate the HTML for one row of the file tree.
    /// </summary>
    /// <param name="controlId">The ID of the surrounding AJAX folder control.</param>
    /// <param name="folder">The folder data.</param>
    /// <returns>The HTML list element for one row of the folder tree.</returns>
    protected string GenerateFolderHtml(string controlId, FolderData folder)
    {
        siteAPI = new SiteAPI();

        // If we're at the root, return the site path
        string sitePath = siteAPI.SitePath.ToString().TrimEnd(new char[] { '/' })
                          .TrimStart(new char[] { '/' });
        if (sitePath != "")
            sitePath += "/";

        if (Page.Request.Url.Host.ToLower().Equals("localhost"))
            sitePath = Context.Request.Url.Scheme + Uri.SchemeDelimiter + System.Net.Dns.GetHostName() + "/" + sitePath;
        else
            sitePath = Context.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + sitePath;

        /*
         * Generate the following HTML:
         *
         * <li id="ekFolder#controlId#_#folderId#\>
         *   <a href="#" onclick="toggleTree('#controlId#', #folderId);">
         *     <img src="#sitePath#Workarea/Tree/images/xp/plusopenfolder.gif" border="0"
         *     </img>
         *   </a>
         *   <a href="#" onclick="ekSelectFolder#controlId#(#folderId)">
         *     #folder.Name#
         *   </a>
         * </li>
         */

        StringBuilder sb = new StringBuilder();
        string folderId = folder.Id.ToString();
        sb.Append("<li id=\"ekFolder");
        sb.Append(controlId);
        sb.Append("_");
        sb.Append(folderId);
        sb.Append("\">");
        // If the folder has children, then output the folder image with a [+] next to it

        // Get a list of subfolders filtered according to user's privs. If the folder has children,
        // then output the folder image with a [+] next to it
        List<FolderData> childFolders = new List<FolderData>(GetFilteredChildFolders(
            folder.Id,
            false,
            EkEnumeration.FolderOrderBy.Id));

        if (childFolders.Count > 0)
        {
            sb.Append("<a onclick=\"toggleTree('");
            sb.Append(controlId);
            sb.Append("', ");
            sb.Append(folderId);
            sb.Append(");\"><img src=\"");
            sb.Append(sitePath);
            sb.Append("Workarea/Tree/images/xp/plusopenfolder.gif\" border=\"0\"></img></a>");
        }
        // Otherwise output standard folder image
        else
        {
            sb.Append("<img src=\"");
            sb.Append(sitePath);
            sb.Append("Workarea/Tree/images/xp/folder.gif\"></img>");
        }
        sb.Append("<a href=\"#\" onclick=\"ekSelectFolder");
        sb.Append(controlId);
        sb.Append("(this,");
        sb.Append(folderId);
        sb.Append(")\">");
        sb.Append(folder.Name);
        sb.Append("</a></li>");
        return sb.ToString();
    }
Example #58
0
    private void Display_EditApprovalOrder()
    {
        bool bFolderUserAdmin = false;
        //FormAction = "content.aspx?LangType=" & m_intContentLanguage & "&action=DoUpdateApprovalOrder&id=" & m_intId & "&type=" & ItemType
        //SetPostBackPage()
        if (ItemType == "folder")
        {
            folder_data = m_refContentApi.GetFolderById(m_intId);
        }
        else
        {
            content_data = m_refContentApi.GetContentById(m_intId, 0);
        }
        ApprovalItemData[] approval_data;
        approval_data = m_refContentApi.GetItemApprovals(m_intId, ItemType);
        security_data = m_refContentApi.LoadPermissions(m_intId, ItemType, 0);
        if (!(folder_data == null))
        {
            bFolderUserAdmin = security_data.IsAdmin || m_refContentApi.IsARoleMemberForFolder_FolderUserAdmin(folder_data.Id, 0, false);
        }
        else
        {
            if (!(content_data == null))
            {
                bFolderUserAdmin = security_data.IsAdmin || m_refContentApi.IsARoleMemberForFolder_FolderUserAdmin(content_data.FolderId, 0, false);
            }
            else
            {
                bFolderUserAdmin = security_data.IsAdmin;
            }
        }
        if (!(security_data.IsAdmin || bFolderUserAdmin))
        {
            throw (new Exception(m_refMsg.GetMessage("error: user not permitted")));
        }
        EditApprovalOrderToolbar();
        string strMsg = "";
        int i = 0;
        if (!(approval_data == null))
        {
            if (approval_data.Length < 20)
            {
                ApprovalList.Rows = approval_data.Length;
            }
            for (i = 0; i <= approval_data.Length - 1; i++)
            {
                if (approval_data[i].UserId > 0)
                {
                    ApprovalList.Items.Add(new ListItem(approval_data[i].DisplayUserName, "user." + approval_data[i].UserId));
                    if (strMsg.Length == 0)
                    {
                        strMsg = "user." + approval_data[i].UserId;
                    }
                    else
                    {
                        strMsg += ",user." + approval_data[i].UserId;
                    }
                }
                else
                {
                    ApprovalList.Items.Add(new ListItem(approval_data[i].DisplayUserGroupName, "group." + approval_data[i].GroupId));
                    if (strMsg.Length == 0)
                    {
                        strMsg = "group." + approval_data[i].GroupId;
                    }
                    else
                    {
                        strMsg += ",group." + approval_data[i].GroupId;
                    }
                }
            }
        }
        td_eao_link.InnerHtml = "<a href=\"javascript:Move(\'up\', document.forms[0]." + UniqueID + "_ApprovalList, document.forms[0]." + UniqueID + "_ApprovalOrder)\">";
        td_eao_link.InnerHtml += "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/arrowHeadUp.png\" valign=middle border=0 width=16 height=16 alt=\"" + m_refMsg.GetMessage("move selection up msg") + "\" title=\"" + m_refMsg.GetMessage("move selection up msg") + "\"></a><br />";
        td_eao_link.InnerHtml += "<a href=\"javascript:Move(\'dn\', document.forms[0]." + UniqueID + "_ApprovalList, document.forms[0]." + UniqueID + "_ApprovalOrder)\">";
        td_eao_link.InnerHtml += "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/arrowHeadDown.png\" valign=middle border=0 width=16 height=16 alt=\"" + m_refMsg.GetMessage("move selection down msg") + "\" title=\"" + m_refMsg.GetMessage("move selection down msg") + "\"></a>";

        td_eao_title.InnerHtml = m_refMsg.GetMessage("move within approvals msg");
        td_eao_msg.InnerHtml = "<label class=\"label\">" + m_refMsg.GetMessage("first approver msg") + "</label>";
        td_eao_ordertitle.InnerHtml = "<h2>" + m_refMsg.GetMessage("approval order title") + "</h2>";
        ApprovalOrder.Value = strMsg;
    }
Example #59
0
    private void DrawFolderTaxonomyTable()
    {
        string categorydatatemplate = "<input type=\"radio\" id=\"taxlist\" name=\"taxlist\" value=\"{0}\" {1} {2}/>{3}";
        StringBuilder categorydata = new StringBuilder();
        TaxonomyRequest catrequest = new TaxonomyRequest();
        string catdisabled = "";

        if (_FolderData == null)
        {
            _FolderData = this.m_refContentApi.GetFolderById(m_iID, true);
        }

        catrequest.TaxonomyId = 0;
        catrequest.TaxonomyLanguage = ContentLanguage;
        catrequest.SortOrder = "taxonomy_name";
        if ((_FolderData.FolderTaxonomy != null) && _FolderData.FolderTaxonomy.Length > 0)
        {
            for (int i = 0; i <= _FolderData.FolderTaxonomy.Length - 1; i++)
            {
                if (_SelectedTaxonomyList.Length > 0)
                {
                    _SelectedTaxonomyList = _SelectedTaxonomyList + "," + _FolderData.FolderTaxonomy[i].TaxonomyId;
                }
                else
                {
                    _SelectedTaxonomyList = _FolderData.FolderTaxonomy[i].TaxonomyId.ToString();
                }
            }
        }
        _CurrentCategoryChecked = Convert.ToInt32(_FolderData.CategoryRequired);
        current_category_required.Value = _CurrentCategoryChecked.ToString();
        inherit_taxonomy_from.Value = _FolderData.TaxonomyInheritedFrom.ToString();
        TaxonomyBaseData[] TaxArr = m_refContentApi.EkContentRef.ReadAllSubCategories(catrequest);
        string DisabledMsg = "";
        if (!_IsTaxonomyUiEnabled)
        {
            DisabledMsg = " disabled ";
            catdisabled = " disabled ";
        }
        bool parent_has_configuration = false;
        if ((TaxArr != null) && TaxArr.Length > 0)
        {
            categorydata.Append("<table class=\"ektronGrid ektronBorder\" width=\"100%\">");
            categorydata.Append("<tr class=\"row\"><td>");
            categorydata.Append(string.Format(categorydatatemplate, "", IsChecked(System.Convert.ToBoolean(_SelectedTaxonomyList.Length == 0)), DisabledMsg, "None"));
            categorydata.Append("<br/>");
            int i = 0;
            while (i < TaxArr.Length)
            {
                _CheckTaxId = TaxArr[i].TaxonomyId;
                if (_FolderData.FolderTaxonomy != null)
                {
                    parent_has_configuration = Array.Exists(_FolderData.FolderTaxonomy, new Predicate<TaxonomyBaseData>(TaxonomyExists));
                }
                else
                {
                    parent_has_configuration = false;
                }
                categorydata.Append("<tr><td>");

                categorydata.Append(string.Format(categorydatatemplate, TaxArr[i].TaxonomyId, IsChecked(parent_has_configuration), DisabledMsg, TaxArr[i].TaxonomyName));
                categorydata.Append("<br/>");
                categorydata.Append("</td></tr>");

                i++;
            }
            categorydata.Append("</table>");
        }

        StringBuilder str = new StringBuilder();
        str.Append("<input type=\"hidden\" id=\"TaxonomyParentHasConfig\" name=\"TaxonomyParentHasConfig\" value=\"");
        if (parent_has_configuration)
        {
            str.Append("1");
        }
        else
        {
            str.Append("0");
        }

        str.Append("\" />");

        DisabledMsg = " ";
        if (_FolderData.Id == 0)
        {
            DisabledMsg = " disabled ";
        }
        else
        {
            DisabledMsg = IsChecked(_FolderData.TaxonomyInherited);
        }
        if (!_IsTaxonomyUiEnabled)
        {
            DisabledMsg += " disabled ";
        }
        string catchecked = "";
        if (_FolderData.CategoryRequired)
        {
            catchecked = " checked ";
        }
        if (_FolderData.Id > 0)
        {
            FolderData parentfolderdata = m_refContentApi.GetFolderById(_FolderData.ParentId, true);
            if ((parentfolderdata.FolderTaxonomy != null) && parentfolderdata.FolderTaxonomy.Length > 0)
            {
                for (int i = 0; i <= parentfolderdata.FolderTaxonomy.Length - 1; i++)
                {
                    if (_SelectedTaxonomyParentList.Length > 0)
                    {
                        _SelectedTaxonomyParentList = _SelectedTaxonomyParentList + "," + parentfolderdata.FolderTaxonomy[i].TaxonomyId;
                    }
                    else
                    {
                        _SelectedTaxonomyParentList = parentfolderdata.FolderTaxonomy[i].TaxonomyId.ToString();
                    }
                }
                _ParentCategoryChecked = Convert.ToInt32(parentfolderdata.CategoryRequired);
                parent_category_required.Value = _ParentCategoryChecked.ToString();
            }
        }

        //str.Append("<input name=""TaxonomyTypeBreak"" id=""TaxonomyTypeBreak"" type=""checkbox"" onclick=""ToggleTaxonomyInherit(this)"" " & DisabledMsg & "/><b>Inherit Parent Taxonomy Configuration</b>")
        str.Append("<input name=\"CategoryRequired\" id=\"CategoryRequired\" type=\"checkbox\"" + catchecked + catdisabled + " /><span class=\"label\">"+m_refMsg.GetMessage("lbl Require category selection")+"</span>");
        str.Append("<div class=\"ektronTopSpace\"></div>");
        str.Append(categorydata.ToString());
        taxonomy_list.Text = str.ToString();
        str = new StringBuilder();

        str.Append("var taxonomytreearr=\"" + _SelectedTaxonomyList + "\".split(\",\");");
        str.Append("var taxonomyparenttreearr=\"" + _SelectedTaxonomyParentList + "\".split(\",\");");
        str.Append("var __jscatrequired=\"" + _CurrentCategoryChecked + "\";");
        str.Append("var __jsparentcatrequired=\"" + _ParentCategoryChecked + "\";");
        tax_js.Text = str.ToString();
    }
Example #60
0
    private void Display_AddPermissions()
    {
        UserGroupData usergroup_data;
        System.Collections.Generic.List<UserGroupData> userGroupDataList = new System.Collections.Generic.List<UserGroupData>();
        UserData user_data;
        System.Collections.Generic.List<UserData> userDataList = new System.Collections.Generic.List<UserData>();
        UserAPI m_refUserAPI = new UserAPI();
        long nFolderId;

        frm_itemid.Value = _Id.ToString();
        frm_type.Value = Request.QueryString["type"];
        frm_base.Value = Request.QueryString["base"];
        frm_permid.Value = Request.QueryString["PermID"];
        frm_membership.Value = Request.QueryString["membership"];

        if (_ItemType == "folder")
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
            nFolderId = _Id;
            if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum))
            {
                _IsBoard = true;
            }
            else if (_FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog))
            {
                _IsBlog = true;
            }
        }
        else
        {
            _ContentData = _ContentApi.GetContentById(_Id, 0);
            _FolderData = _ContentApi.GetFolderById(_ContentData.FolderId);
            nFolderId = _ContentData.FolderId;
        }
        AddPermissionsToolBar();
        if (Request.QueryString["base"] == "group")
        {
            usergroup_data = m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]));
            Populate_AddPermissionsGenericGrid(usergroup_data);
            Populate_AddPermissionsAdvancedGrid(usergroup_data);
            _IsMembership = usergroup_data.IsMemberShipGroup;
        }
        else if (Request.QueryString["base"] == "user")
        {
            user_data = m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Request.QueryString["PermID"]), false, false);
            Populate_AddPermissionsGenericGrid(user_data);
            Populate_AddPermissionsAdvancedGrid(user_data);
            _IsMembership = user_data.IsMemberShip;
        }
        else
        {
            string[] Groups = Request.QueryString["groupIDS"].Split(",".ToCharArray());
            string[] Users = Request.QueryString["userIDS"].Split(",".ToCharArray());
            int groupCount = 0;
            int userCount = 0;

            if (Request.QueryString["groupIDS"] != "")
            {
                for (groupCount = 0; groupCount <= Groups.Length - 1; groupCount++)
                {
                    userGroupDataList.Add(m_refUserAPI.GetUserGroupByIdForFolderAdmin(nFolderId, Convert.ToInt64(Groups[groupCount])));
                }
                _IsMembership = userGroupDataList[0].IsMemberShipGroup;
            }
            if (Request.QueryString["userIDS"] != "")
            {
                for (userCount = 0; userCount <= Users.Length - 1; userCount++)
                {
                    userDataList.Add(m_refUserAPI.GetUserByIDForFolderAdmin(nFolderId, Convert.ToInt64(Users[userCount]), false, false));
                }
                _IsMembership = userDataList[0].IsMemberShip;
            }
            Populate_AddPermissionsGenericGridForUsersAndGroup(userGroupDataList, userDataList);
            Populate_AddPermissionsAdvancedGridForUsersAndGroup(userGroupDataList, userDataList);
        }

        if (_IsMembership)
        {
            td_ep_membership.Visible = false;
            hmembershiptype.Value = "1";
        }
        else
        {
            td_ep_membership.InnerHtml = _StyleHelper.GetEnableAllPrompt();
            hmembershiptype.Value = "0";
        }
    }