예제 #1
0
 public void UpdateInstance(IDataClass obj)
 {
     if (null != obj)
     {
         obj.StringValue = "һ����";
     }
 }
    /// <summary>
    /// Load Columns names into listbox.
    /// </summary>
    protected void LoadFromDataClass()
    {
        // Get selected classes from hiddenfield.
        ArrayList classesList = new ArrayList();
        ArrayList columnList  = new ArrayList();

        if (!string.IsNullOrEmpty(hdnClassNames.Value))
        {
            classesList = new ArrayList(hdnClassNames.Value.Split(';'));
        }

        classesList.Add("CMS.Tree");
        classesList.Add("CMS.Document");

        // Fill columnList with column names from all classes.
        foreach (string className in classesList)
        {
            try
            {
                if (!String.IsNullOrEmpty(className))
                {
                    IDataClass    dc  = DataClassFactory.NewDataClass(className);
                    DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(className);
                    // Get columns only from couplet classes.
                    if (dci.ClassIsCoupledClass)
                    {
                        foreach (string columnName in dc.StructureInfo.ColumnNames)
                        {
                            columnList.Add(columnName);
                        }
                    }
                }
            }
            catch
            {
            }
        }

        // Move columns from array list to string array and add indexes.
        string[,] columns = new string[columnList.Count, 2];
        int index = 0;

        foreach (string columnName in columnList)
        {
            columns[index, 0] = index.ToString();
            columns[index, 1] = columnName;
            index            += 1;
        }

        ItemSelection1.LeftItems = columns;
        ItemSelection1.fill();
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = CMSContext.CurrentUser;
        if (currentUser == null)
        {
            return;
        }

        // No cms.blog doc. type
        if (DataClassInfoProvider.GetDataClass("cms.blog") == null)
        {
            RedirectToInformation(GetString("blog.noblogdoctype"));
        }

        // Check if user is authorized to manage
        isAuthorized = currentUser.IsAuthorizedPerResource("CMS.Blog", "Manage") || (currentUser.IsAuthorizedPerClassName("cms.blog", "Manage", CMSContext.CurrentSiteName) &&
                                                                                     currentUser.IsAuthorizedPerClassName("cms.blogpost", "Manage", CMSContext.CurrentSiteName));

        gridBlogs.OnExternalDataBound += gridBlogs_OnExternalDataBound;
        gridBlogs.OnDataReload        += gridBlogs_OnDataReload;
        gridBlogs.ShowActionsMenu      = true;
        gridBlogs.Columns              = "BlogID, ClassName, BlogName, NodeID, DocumentCulture, NodeOwner, BlogModerators";

        // Get all possible columns to retrieve
        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di        = new DocumentInfo();
        BlogInfo     bi        = new BlogInfo();

        gridBlogs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));



        // Get ClassID of the 'cms.blogpost' class
        DataClassInfo dci     = DataClassInfoProvider.GetDataClass("cms.blogpost");
        string        classId = "";
        string        script  = "";

        if (dci != null)
        {
            classId = dci.ClassID.ToString();
        }

        // Get scritp to redirect to new blog post page
        script += "function NewPost(parentId, culture) { \n";
        script += "     if (parentId != 0) { \n";
        script += "         parent.parent.parent.location.href = \"" + ResolveUrl("~/CMSDesk/default.aspx") + "?section=content&action=new&nodeid=\" + parentId + \"&classid=" + classId + "&culture=\" + culture;";
        script += "}} \n";

        // Generate javascript code
        ltlScript.Text = ScriptHelper.GetScript(script);
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        gridLanguages.FilteredZeroRowsText = GetString("transman.nodocumentculture");
        gridLanguages.OnDataReload        += gridDocuments_OnDataReload;
        gridLanguages.OnExternalDataBound += gridLanguages_OnExternalDataBound;
        gridLanguages.ShowActionsMenu      = true;
        gridLanguages.Columns = "DocumentName,  Published";

        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di        = new DocumentInfo();

        gridLanguages.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames), SqlHelperClass.MergeColumns(nodeClass.ColumnNames));

        pnlContainer.Enabled = !DocumentManager.ProcessingAction;
    }
예제 #5
0
        public static void GenerateMaze(string name, int generateType)
        {
            Maze maze = new Maze(name, mazeHeight, mazeLength, mazeVals);

            if (generateType == 0)
            {
                maze.CreateMaze(new RandomMazeMaker());
            }
            else if (generateType == 1)
            {
                maze.CreateMaze(new DFSMazeMaker());
            }
            MDB.AddMaze(maze);
            data = new MazeDataClass(maze.name, maze.ToString(), new NodeDataClass(maze.start.location.row, maze.start.location.col),
                                     new NodeDataClass(maze.end.location.row, maze.end.location.col));
        }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get ID of node
        nodeId = QueryHelper.GetInteger("nodeid", 0);

        gridLanguages.FilteredZeroRowsText = GetString("transman.nodocumentculture");
        gridLanguages.OnDataReload        += gridDocuments_OnDataReload;
        gridLanguages.OnExternalDataBound += gridLanguages_OnExternalDataBound;
        gridLanguages.ShowActionsMenu      = true;
        gridLanguages.Columns = "DocumentModifiedWhen, DocumentLastPublished, DocumentName, VersionNumber, Published";

        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di        = new DocumentInfo();

        gridLanguages.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uniGrid.OnDataReload        += uniGrid_OnDataReload;
        uniGrid.OnExternalDataBound += uniGrid_OnExternalDataBound;
        uniGrid.ShowActionsMenu      = true;
        uniGrid.Columns              = "NodeID, DocumentName, DocumentNamePath, DocumentCulture, DocumentModifiedWhen, ClassDisplayName, NodeChildNodesCount";
        uniGrid.OnBeforeDataReload  += uniGrid_OnBeforeDataReload;

        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di        = new DocumentInfo();

        uniGrid.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames), SqlHelperClass.MergeColumns(nodeClass.ColumnNames));

        nodeId   = QueryHelper.GetInteger("nodeid", 0);
        serverId = QueryHelper.GetInteger("serverid", 0);
        if (nodeId > 0)
        {
            TreeNode node = TreeProvider.SelectSingleNode(nodeId);
            if (node != null)
            {
                if (node.NodeParentID > 0)
                {
                    lnkUpperDoc.Attributes["onclick"] = "parent.frames['tasksTree'].RefreshNode(" + node.NodeParentID + "," + node.NodeParentID + ");window.location.href='" +
                                                        ResolveUrl("~/CMSModules/Staging/Tools/Tasks/DocumentsList.aspx?serverid=") + serverId +
                                                        "&nodeid=" + node.NodeParentID + "'; return false;";
                    imgUpperDoc.ImageUrl = GetImageUrl("Design/Controls/Tree/folderup.png");
                }
                else
                {
                    lnkUpperDoc.Attributes["onclick"] = "return false";
                    imgUpperDoc.ImageUrl = GetImageUrl("Design/Controls/Tree/folderupdisabled.png");
                }
                string closeLink = "<a href=\"#\"><span class=\"ListingClose\" style=\"cursor: pointer;\" " +
                                   "onclick=\"parent.frames['tasksHeader'].selectDocuments = false; window.location.href='" +
                                   ResolveUrl("~/CMSModules/Staging/Tools/Tasks/Tasks.aspx?serverid=") + serverId +
                                   "&nodeid=" + nodeId + "';" +
                                   "var completeObj = parent.frames['tasksHeader'].document.getElementById('pnlComplete');" +
                                   "if (completeObj != null){ completeObj.style.display = 'block'; }" +
                                   "return false;\">" + GetString("general.close") +
                                   "</span></a>";
                string docNamePath = "<span class=\"ListingPath\">" + node.DocumentNamePath + "</span>";

                lblListingInfo.Text = String.Format(GetString("synchronization.listinginfo"), docNamePath, closeLink);
            }
        }
    }
예제 #8
0
        internal void copySelectedStatus2()
        {
            var elem = NeoOCI.create_from_selected();

            if (elem is VNActor.Actor chara)
            {
                clipboard_status2 = (IDataClass <IVNObject <object> >)chara.export_full_status();
            }
            else if (elem is Prop prop)
            {
                clipboard_status2 = (IDataClass <IVNObject <object> >)prop.export_full_status();
            }
            else
            {
                show_blocking_message_time_sc("Can't copy status 2");
            }
        }
예제 #9
0
    /// <summary>
    /// Load Columns names from Tree.
    /// </summary>
    protected void LoadFromDataClass(string classNames)
    {
        List <string> columnList  = new List <string>();
        List <string> classesList = new List <string>();

        if (!string.IsNullOrEmpty(classNames))
        {
            classesList = new List <string>(classNames.Split(';'));
        }

        // If more than 1 DataClasses are in classesList, get columns only from CMS.Tree and CMS.Document.
        //if (classesList.Count > 1)
        //{
        //    classesList = new List<string>();
        //}
        classesList.Add("CMS.Tree");
        classesList.Add("CMS.Document");
        classesList.Add("CMS.Category");

        // Fill columnList with column names from all classes.
        foreach (string className in classesList)
        {
            try
            {
                if (className != "")
                {
                    IDataClass    dc  = DataClassFactory.NewDataClass(className);
                    DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(className);

                    // Get columns only from couplet classes.
                    if (dci.ClassIsCoupledClass)
                    {
                        foreach (string columnName in dc.StructureInfo.ColumnNames)
                        {
                            columnList.Add(columnName);
                        }
                    }
                }
            }
            catch
            {
            }
        }
        // Set string array.
        mColumnList = columnList.ToArray();
    }
예제 #10
0
 public static IDataClass <T> get_status_diff_optimized <T>(IDataClass <T> oldstatus, IDataClass <T> status)
 {
     /* TODO
      * var ofs = oldstatus;
      * var dfs = new Dictionary<string, object>
      * {
      * };
      * foreach (var key in status.Keys)
      * {
      *  if (!ofs.ContainsKey(key) || ofs[key] != status[key])
      *  {
      *      dfs[key] = status[key];
      *  }
      * }
      * //return dfs
      * //print "Optimized import status diff, ", dfs
      */
     return(status);
 }
예제 #11
0
    protected void gridData_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLower())
        {
        case "delete":
            CheckPermissions("DeleteData");

            // Get record ID
            int formRecordID = ValidationHelper.GetInteger(actionArgument, 0);

            // Get BizFormInfo object
            if (bfi != null)
            {
                // Get class object
                if (dci != null)
                {
                    // Get record object
                    IDataClass formRecord = DataClassFactory.NewDataClass(dci.ClassName, formRecordID);
                    if (!formRecord.IsEmpty())
                    {
                        // Delete all files of the record
                        BizFormInfoProvider.DeleteBizFormRecordFiles(dci.ClassFormDefinition, formRecord, CMSContext.CurrentSiteName);

                        // Delete the form record
                        formRecord.Delete();

                        // Update number of entries in BizFormInfo
                        if (bfi != null)
                        {
                            BizFormInfoProvider.RefreshDataCount(bfi.FormName, bfi.FormSiteID);
                        }
                    }
                }
            }

            break;
        }
    }
        /// <summary>
        /// Gets media file info object representing the updated version of original file
        /// </summary>
        private MediaFileInfo GetUpdatedFile(IDataClass origFileDataClass, UploaderHelper args, MediaLibraryInfo mli)
        {
            // Get info on media file from uploaded file
            MediaFileInfo mediaFile = new MediaFileInfo(args.FilePath, args.MediaLibraryArgs.LibraryID, args.MediaLibraryArgs.FolderPath, args.ResizeToWidth, args.ResizeToHeight, args.ResizeToMaxSide);

            // Create new file based on original
            MediaFileInfo updatedMediaFile = new MediaFileInfo(origFileDataClass)
                                                 {
                                                     // Update necessary information
                                                     FileName = mediaFile.FileName,
                                                     FileExtension = mediaFile.FileExtension,
                                                     FileSize = mediaFile.FileSize,
                                                     FileMimeType = mediaFile.FileMimeType,
                                                     FilePath = mediaFile.FilePath,
                                                     FileModifiedByUserID = mediaFile.FileModifiedByUserID,
                                                     FileBinary = mediaFile.FileBinary,
                                                     FileImageHeight = mediaFile.FileImageHeight,
                                                     FileImageWidth = mediaFile.FileImageWidth,
                                                     FileBinaryStream = mediaFile.FileBinaryStream
                                                 };

            return updatedMediaFile;
        }
    /// <summary>
    /// Gets media file info object representing the updated version of original file.
    /// </summary>
    /// <param name="originalFile">Original file data</param>
    private MediaFileInfo GetUpdatedFile(IDataClass originalFile)
    {
        // Get info on media file from uploaded file
        MediaFileInfo mediaFile = new MediaFileInfo(ucFileUpload.PostedFile, LibraryID, LibraryFolderPath, ResizeToWidth, ResizeToHeight, ResizeToMaxSideSize, LibraryInfo.LibrarySiteID);

        // Create new file based on original
        MediaFileInfo updatedMediaFile = new MediaFileInfo(originalFile)
        {
            // Update necessary information
            FileName             = mediaFile.FileName,
            FileExtension        = mediaFile.FileExtension,
            FileSize             = mediaFile.FileSize,
            FileMimeType         = mediaFile.FileMimeType,
            FilePath             = mediaFile.FilePath,
            FileModifiedByUserID = mediaFile.FileModifiedByUserID,
            FileBinary           = mediaFile.FileBinary,
            FileImageHeight      = mediaFile.FileImageHeight,
            FileImageWidth       = mediaFile.FileImageWidth,
            FileBinaryStream     = mediaFile.FileBinaryStream
        };

        return(updatedMediaFile);
    }
예제 #14
0
        /// <summary>
        /// Gets media file info object representing the updated version of original file
        /// </summary>
        private MediaFileInfo GetUpdatedFile(IDataClass origFileDataClass, UploaderHelper args, MediaLibraryInfo mli)
        {
            // Get info on media file from uploaded file
            MediaFileInfo mediaFile = new MediaFileInfo(args.FilePath, args.MediaLibraryArgs.LibraryID, args.MediaLibraryArgs.FolderPath, args.ResizeToWidth, args.ResizeToHeight, args.ResizeToMaxSide);

            // Create new file based on original
            MediaFileInfo updatedMediaFile = new MediaFileInfo(origFileDataClass)
            {
                // Update necessary information
                FileName             = mediaFile.FileName,
                FileExtension        = mediaFile.FileExtension,
                FileSize             = mediaFile.FileSize,
                FileMimeType         = mediaFile.FileMimeType,
                FilePath             = mediaFile.FilePath,
                FileModifiedByUserID = mediaFile.FileModifiedByUserID,
                FileBinary           = mediaFile.FileBinary,
                FileImageHeight      = mediaFile.FileImageHeight,
                FileImageWidth       = mediaFile.FileImageWidth,
                FileBinaryStream     = mediaFile.FileBinaryStream
            };

            return(updatedMediaFile);
        }
예제 #15
0
    /// <summary>
    /// Initializes the controls on the page.
    /// </summary>
    private void SetupControls()
    {
        lblBoardName.Text = GetString("board.boardlist.boardname");
        btnFilter.Text    = GetString("general.show");

        gridBoards.IsLiveSite           = IsLiveSite;
        gridBoards.GridName             = (!string.IsNullOrEmpty(GridName)) ? GridName : "~/CMSModules/MessageBoards/Tools/Boards/Board_List.xml";
        gridBoards.OrderBy              = "BoardDisplayName ASC";
        gridBoards.IsLiveSite           = IsLiveSite;
        gridBoards.OnAction            += gridBoards_OnAction;
        gridBoards.OnExternalDataBound += gridBoards_OnExternalDataBound;
        gridBoards.OnDataReload        += gridBoards_OnDataReload;
        gridBoards.OnBeforeDataReload  += gridBoards_OnBeforeDataReload;
        gridBoards.ZeroRowsText         = GetString("general.nodatafound");
        gridBoards.ShowActionsMenu      = true;
        gridBoards.Columns              = "BoardID, BoardDisplayName, BoardEnabled, BoardModerated, BoardMessages, BoardLastMessageTime, BoardDocumentID, BoardOpened, NodeID, NodeSiteID, DocumentNamePath, DocumentCulture, ClassName";

        // Get all possible column names.
        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        BoardInfo    bi        = new BoardInfo();
        DocumentInfo di        = new DocumentInfo();

        gridBoards.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bi.ColumnNames), SqlHelperClass.MergeColumns(di.ColumnNames)), SqlHelperClass.MergeColumns(nodeClass.ColumnNames));
    }
예제 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UIContext.PropertyTab = PropertyTabEnum.LinkedDocs;

        nodeId          = QueryHelper.GetInteger("nodeid", 0);
        currentSiteName = CMSContext.CurrentSiteName.ToLower();

        tree = new TreeProvider(currentUser);
        node = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES, tree.CombineWithDefaultCulture, false);
        // Set edited document
        EditedDocument = node;

        gridDocs.OnExternalDataBound += gridDocuments_OnExternalDataBound;
        gridDocs.OnAction            += gridDocs_OnAction;
        gridDocs.OnDataReload        += gridDocs_OnDataReload;
        gridDocs.ShowActionsMenu      = true;
        gridDocs.Columns              = "NodeAliasPath, SiteName, NodeParentID, DocumentName, DocumentNamePath, ClassDisplayName";

        // Get all possible columns to retrieve
        IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
        DocumentInfo di        = new DocumentInfo();

        gridDocs.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));
    }
예제 #17
0
    public string CreateUpdateLoginUserinKentico(string username, string firstname, string lastname, string email, string groupNames, bool memberflag, bool orgflag, string customerIdentifier, string customerToken)
    {
        string UserCreated = "";

        try
        {
            UserInfo userUpdate = CMS.Membership.UserInfoProvider.GetUserInfo(username);

            if (!(userUpdate != null))
            {
                UserInfo user = new UserInfo();
                user.UserName  = username;
                user.FirstName = firstname;
                user.LastName  = lastname;
                user.FullName  = firstname + " " + lastname;
                user.Email     = email;
                user.SetPersonifyIdentifier(customerIdentifier);
                user.SetLastCustomerToken(customerToken);
                // user.IsEditor = false;

                user.PreferredCultureCode = "en-us";
                user.PasswordFormat       = "SHA1";
                user.Enabled = true;
                //user.IsExternal = true;
                CMS.Membership.UserInfoProvider.SetUserInfo(user);
                CMS.Membership.UserInfoProvider.SetPassword(username, username);
                UserInfoProvider.AddUserToSite(username, CMS.SiteProvider.SiteContext.CurrentSiteName);
                UserCreated = "UserName: "******"<br/> " + "Password: "******": ";
            }
            else
            {
                //UpdateUserinKentico(userUpdate);
                //string shaPass = CalculateSHA1("", Encoding.ASCII);
                //string kenticoPass = userUpdate.GetValue("UserPassword").ToString();
                // if (kenticoPass != shaPass)
                // {
                IDataClass userObj  = DataClassFactory.NewDataClass("cms.user", userUpdate.UserID);
                string     userName = (string)userObj.GetValue("username");
                userObj.SetValue("UserName", userUpdate.UserName.ToString());
                // userObj.SetValue("UserPassword", GenerateSHA1(username.ToString()));
                userObj.SetValue("FirstName", firstname);
                userObj.SetValue("LastName", lastname);
                userObj.SetValue("FullName", firstname + " " + lastname);
                userObj.SetValue("Email", email);
                userObj.SetValue("PersonifyIdentifier", customerIdentifier);
                userObj.SetValue("LastCustomerToken", customerToken);
                userObj.Update();
                UserCreated = "UserName: "******"<br/> " + "Password: "******": ";
                //}
            }
            UserInfo userNew = CMS.Membership.UserInfoProvider.GetUserInfo(username);
            // groups(userNew, groupNames);

            ///add user to roles for protection purposes
            AddUserToRole(userNew, groupNames, memberflag, orgflag);

            //login User too
            UserCreated = LoginUserinKentico(userNew.UserName);
            return(UserCreated);
        }

        catch (Exception ex)
        {
            //delete user if created
            EventLogProvider.LogException("CreateUpdateUserinKentico", "Get", ex);
            return(null);
        }
    }
예제 #18
0
 public void import_status(IDataClass <Route> status)
 {
     throw new NotImplementedException();
 }
    /// <summary>
    /// Gets media file info object representing the updated version of original file.
    /// </summary>
    /// <param name="originalFile">Original file data</param>
    private MediaFileInfo GetUpdatedFile(IDataClass originalFile)
    {
        // Get info on media file from uploaded file
        MediaFileInfo mediaFile = new MediaFileInfo(ucFileUpload.PostedFile, LibraryID, LibraryFolderPath, ResizeToWidth, ResizeToHeight, ResizeToMaxSideSize, LibraryInfo.LibrarySiteID);

        // Create new file based on original
        MediaFileInfo updatedMediaFile = new MediaFileInfo(originalFile)
        {
            // Update necessary information
            FileName = mediaFile.FileName,
            FileExtension = mediaFile.FileExtension,
            FileSize = mediaFile.FileSize,
            FileMimeType = mediaFile.FileMimeType,
            FilePath = mediaFile.FilePath,
            FileModifiedByUserID = mediaFile.FileModifiedByUserID,
            FileBinary = mediaFile.FileBinary,
            FileImageHeight = mediaFile.FileImageHeight,
            FileImageWidth = mediaFile.FileImageWidth,
            FileBinaryStream = mediaFile.FileBinaryStream
        };

        return updatedMediaFile;
    }
예제 #20
0
    /// <summary>
    /// Reloads control with new data.
    /// </summary>
    private void ReloadData()
    {
        tblDocument.Rows.Clear();

        DataClassInfo ci = DataClassInfoProvider.GetDataClass(Node.NodeClassName);

        if (ci != null)
        {
            fi = FormHelper.GetFormInfo(ci.ClassName, false);

            TableHeaderCell labelCell    = new TableHeaderCell();
            TableHeaderCell valueCell    = null;
            TableHeaderCell valueCompare = null;

            // Add header column with version number
            if (CompareNode == null)
            {
                labelCell.Text            = GetString("General.FieldName");
                labelCell.EnableViewState = false;
                valueCell = new TableHeaderCell();
                valueCell.EnableViewState = false;
                valueCell.Text            = GetString("General.Value");

                // Add table header
                AddRow(labelCell, valueCell, "UniGridHead", false);
            }
            else
            {
                labelCell.Text = GetString("lock.versionnumber");
                valueCell      = GetRollbackTableHeaderCell("source", Node.DocumentID, versionHistoryId);
                valueCompare   = GetRollbackTableHeaderCell("compare", CompareNode.DocumentID, versionCompare);

                // Add table header
                AddRow(labelCell, valueCell, valueCompare, true, "UniGridHead", false);
            }

            if (ci.ClassIsCoupledClass)
            {
                // Add coupled class fields
                IDataClass coupleClass = DataClassFactory.NewDataClass(Node.NodeClassName);
                if (coupleClass != null)
                {
                    foreach (string col in coupleClass.StructureInfo.ColumnNames)
                    {
                        // If comparing with other version and current coupled column is not versioned do not display it
                        if (!((CompareNode != null) && !(VersionManager.IsVersionedCoupledColumn(Node.NodeClassName, col))))
                        {
                            AddField(Node, CompareNode, col);
                        }
                    }
                }
            }

            // Add versioned document class fields
            IDataClass docClass = DataClassFactory.NewDataClass("cms.document");
            if (docClass != null)
            {
                foreach (string col in docClass.StructureInfo.ColumnNames)
                {
                    // If comparing with other version and current document column is not versioned do not display it
                    // One exception is DocumentNamePath column which will be displayed even if it is not marked as a versioned column
                    if (!((CompareNode != null) && (!(VersionManager.IsVersionedDocumentColumn(col) || (col.ToLower() == "documentnamepath")))))
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add versioned document class fields
            IDataClass treeClass = DataClassFactory.NewDataClass("cms.tree");
            if (treeClass != null)
            {
                foreach (string col in treeClass.StructureInfo.ColumnNames)
                {
                    // Do not display cms_tree columns when comparing with other version
                    // cms_tree columns are not versioned
                    if (CompareNode == null)
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add unsorted attachments to the table
            AddField(Node, CompareNode, UNSORTED);
        }
    }
예제 #21
0
 public Calculator(IDataClass DInput)
 {
     DObj = DInput;
 }
예제 #22
0
 public override void import_status(IDataClass status)
 {
     throw new NotImplementedException();
 }
예제 #23
0
 public MovieService(IDataClass dataClass)
 {
     this.dataClass = dataClass;
 }
예제 #24
0
 public MetadataService(IDataClass dataClass)
 {
     this.dataClass = dataClass;
 }
예제 #25
0
 public void import_status(IDataClass <Prop> status)
 {
     status.Apply(this);
 }
예제 #26
0
 public BusinessClass(IDataClass obj)
 {
     dataClass = obj;
 }
예제 #27
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterScriptFile(this, @"~/CMSModules/Content/CMSDesk/View/Listing.js");

        currentSiteName = CMSContext.CurrentSiteName;
        currentUserInfo = CMSContext.CurrentUser;

        // Current Node ID
        nodeId = QueryHelper.GetInteger("nodeid", 0);

        // Setup page title text and image
        CurrentMaster.Title.TitleText  = GetString("Content.ListingTitle");
        CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Content/Menu/Listing.png");

        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "list_tab";

        string[,] actions = new string[1, 6];
        actions[0, 0]     = HeaderActions.TYPE_HYPERLINK;
        actions[0, 1]     = GetString("Listing.ParentDirectory");
        actions[0, 5]     = GetImageUrl("CMSModules/CMS_Content/Listing/parent.png");
        CurrentMaster.HeaderActions.Actions = actions;

        if (nodeId > 0)
        {
            tree             = new TreeProvider(currentUserInfo);
            checkPermissions = tree.CheckDocumentUIPermissions(currentSiteName);
            node             = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES);
            // Set edited document
            EditedDocument = node;

            if (node != null)
            {
                if (currentUserInfo.IsAuthorizedPerDocument(node, NodePermissionsEnum.ExploreTree) != AuthorizationResultEnum.Allowed)
                {
                    RedirectToCMSDeskAccessDenied("CMS.Content", "exploretree");
                }

                aliasPath = node.NodeAliasPath;

                // Setup the link to the parent document
                if ((node.NodeClassName.ToLower() != "cms.root") && (currentUserInfo.UserStartingAliasPath.ToLower() != node.NodeAliasPath.ToLower()))
                {
                    CurrentMaster.HeaderActions.Actions[0, 3] = "javascript:SelectItem(" + node.NodeParentID + ");";
                }
                else
                {
                    CurrentMaster.HeaderActions.Visible = false;
                    CurrentMaster.PanelBody.FindControl("pnlActions").Visible = false;
                }
            }

            ScriptHelper.RegisterProgress(this);
            ScriptHelper.RegisterDialogScript(this);
            ScriptHelper.RegisterJQuery(this);

            InitDropdowLists();

            cultureElem.DropDownCultures.Width = 222;

            // Prepare JavaScript for actions
            StringBuilder actionScript = new StringBuilder();
            actionScript.Append(
                @"function PerformAction(selectionFunction, selectionField, dropId){
    var label = document.getElementById('" + lblInfo.ClientID + @"');
    var whatDrp = document.getElementById('" + drpWhat.ClientID + @"');
    var action = document.getElementById(dropId).value;
    var selectionFieldElem = document.getElementById(selectionField);
    var allSelected = " + (int)What.SelectedDocuments + @";
    if (action == '" + (int)Action.SelectAction + @"'){
        label.innerHTML = '" + GetString("massaction.selectsomeaction") + @"';
        return false;
    }
    if(whatDrp.value == '" + (int)What.AllDocuments + @"'){
        allSelected = " + (int)What.AllDocuments + @";
    }
    var items = selectionFieldElem.value;
    if(!eval(selectionFunction) || whatDrp.value == '" + (int)What.AllDocuments + @"'){
        var argument = '|' + allSelected + '|' + items;
        switch(action){
            case '" + (int)Action.Move + @"':
                argument = '" + Action.Move + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @";
                break;

            case '" + (int)Action.Copy + @"':
                argument = '" + Action.Copy + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @";
                break;

            case '" + (int)Action.Link + @"':
                argument = '" + Action.Link + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "OpenModal", string.Empty) + @";
                break;

            case '" + (int)Action.Delete + @"':
                argument = '" + Action.Delete + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @";
                break;

            case '" + (int)Action.Publish + @"':
                argument = '" + Action.Publish + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @";
                break;

            case '" + (int)Action.Archive + @"':
                argument = '" + Action.Archive + "' + argument;" + ClientScript.GetCallbackEventReference(this, "argument", "Redirect", string.Empty) + @";
                break;

            default:
                return false;
        }
    }
    else{
        label.innerHTML = '" + GetString("documents.selectdocuments") + @"';
    }
    return false;
}

function OpenModal(arg, context){
    modalDialog(arg,'actionDialog','90%', '85%');
}

function Redirect(arg, context){
    document.location.replace(arg);
}");

            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "actionScript", ScriptHelper.GetScript(actionScript.ToString()));

            // Add action to button
            btnOk.OnClientClick = "return PerformAction('" + gridDocuments.GetCheckSelectionScript() + "','" + gridDocuments.GetSelectionFieldClientID() + "','" + drpAction.ClientID + "');";

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Move), Convert.ToInt32(Action.Move).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Copy), Convert.ToInt32(Action.Copy).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Link), Convert.ToInt32(Action.Link).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Delete), Convert.ToInt32(Action.Delete).ToString()));
                if (currentUserInfo.IsGlobalAdministrator || currentUserInfo.IsAuthorizedPerResource("CMS.Content", "ManageWorkflow"))
                {
                    drpAction.Items.Add(new ListItem(GetString("general." + Action.Publish), Convert.ToInt32(Action.Publish).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("general." + Action.Archive), Convert.ToInt32(Action.Archive).ToString()));
                }

                drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.SelectedDocuments), Convert.ToInt32(What.SelectedDocuments).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.AllDocuments), Convert.ToInt32(What.AllDocuments).ToString()));
            }

            // Setup the grid
            gridDocuments.OnExternalDataBound += gridDocuments_OnExternalDataBound;
            gridDocuments.OnBeforeDataReload  += gridDocuments_OnBeforeDataReload;
            gridDocuments.OnDataReload        += gridDocuments_OnDataReload;
            gridDocuments.ZeroRowsText         = GetString("content.nochilddocumentsfound");
            gridDocuments.ShowActionsMenu      = true;
            if (node != null)
            {
                gridDocuments.WhereCondition = "NodeParentID = " + node.NodeID + " AND NodeLevel = " + (node.NodeLevel + 1);
            }

            // Initialize columns
            string columns = @"DocumentLastVersionName, DocumentName, NodeParentID,
                    ClassDisplayName, DocumentModifiedWhen, Published, DocumentLastVersionNumber, DocumentMenuRedirectURL, DocumentLastVersionMenuRedirectUrl, DocumentIsArchived, DocumentCheckedOutByUserID,
                    DocumentPublishedVersionHistoryID, DocumentWorkflowStepID, DocumentCheckedOutVersionHistoryID, DocumentNamePath, DocumentPublishFrom, DocumentType, DocumentLastVersionType, NodeAliasPath";

            if (checkPermissions)
            {
                columns = SqlHelperClass.MergeColumns(columns, TreeProvider.SECURITYCHECK_REQUIRED_COLUMNS);
            }
            gridDocuments.Columns = columns;

            StringBuilder refreshScripts = new StringBuilder();
            refreshScripts.Append(
                @"function RefreshTree()
{
    if((parent != null) && (parent.parent != null) && (parent.parent.frames['contenttree'] != null) && (parent.parent.frames['contenttree'].RefreshNode != null))
    {
        parent.parent.frames['contenttree'].RefreshNode(", nodeId, @",", nodeId, @");
    }
}
function ClearSelection()
{ 
", gridDocuments.GetClearSelectionScript(), @"
}
function RefreshGrid()
{
    ClearSelection();
    RefreshTree();",
                ClientScript.GetPostBackEventReference(btnShow, "null"), @"
}");
            // Register refresh scripts
            string refreshScript = ScriptHelper.GetScript(refreshScripts.ToString());
            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "refreshListing", refreshScript);

            // Get all possible columns to retrieve
            IDataClass   nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
            DocumentInfo di        = new DocumentInfo();
            gridDocuments.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(di.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));
        }
    }