Exemplo n.º 1
0
        public virtual JObject CreateNewFolder(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        path    = request.GetString("path", "");

            string folderName;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                folderName = cn.CreateNewFolder(zone, path);
            }

            string folderPath;

            if (String.IsNullOrEmpty(path))
            {
                folderPath = folderName;
            }
            else
            {
                folderPath = path + "/" + folderName;
            }

            JObject item = new JObject();

            item["leaf"]    = false;
            item["text"]    = folderName;
            item["iconCls"] = "folder";
            item["path"]    = folderPath;
            item["rsid"]    = zone.ToString() + "://" + folderPath;
            return(item);
        }
Exemplo n.º 2
0
        public virtual JObject GetFolders(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        path    = request.GetString("node");
            bool          expand  = request.GetBool("expand", false);

            if (path == "root")
            {
                path = null;
            }

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                JObject rv = new JObject();

                JArray items = new JArray();
                rv[YZJsonProperty.children] = items;

                this.ExpandTree(cn, items, path, zone, expand);

                rv[YZJsonProperty.success] = true;
                return(rv);
            }
        }
Exemplo n.º 3
0
        public virtual BPMObjectNameCollection GetStoreFolders(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        folder  = request.GetString("folder", null);

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                return(cn.GetFolders(zone, folder));
            }
        }
Exemplo n.º 4
0
        public virtual void DeleteFolder(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        path    = request.GetString("path");

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                cn.DeleteFolder(zone, path);
            }
        }
Exemplo n.º 5
0
        public virtual string RenameFolder(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        path    = request.GetString("path");
            string        newname = request.GetString("newname");

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                return(cn.RenameFolder(zone, path, newname));
            }
        }
Exemplo n.º 6
0
        public virtual void DeleteObjects(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        folder  = request.GetString("folder", "");
            JArray        jPost   = request.GetPostData <JArray>();
            StoreObjectIdentityCollection objects = jPost.ToObject <StoreObjectIdentityCollection>();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                cn.DeleteObjects(zone, folder, objects);
            }
        }
Exemplo n.º 7
0
        public virtual void RenameObject(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        folder  = request.GetString("folder", "");
            string        name    = request.GetString("name");
            string        newname = request.GetString("newname");
            string        path    = System.IO.Path.Combine(folder, name);

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                cn.RenameObject(zone, path, newname);
            }
        }
Exemplo n.º 8
0
        public virtual void MoveObjectsToFolder(HttpContext context)
        {
            YZRequest               request     = new YZRequest(context);
            StoreZoneType           zone        = request.GetEnum <StoreZoneType>("zone");
            string                  srcfolder   = request.GetString("srcfolder", null);
            string                  tagfolder   = request.GetString("tagfolder", null);
            bool                    copy        = request.GetBool("copy", false);
            JArray                  post        = request.GetPostData <JArray>();
            BPMObjectNameCollection objectNames = post.ToObject <BPMObjectNameCollection>();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                cn.MoveObjectsToFolder(zone, srcfolder, objectNames, tagfolder, copy);
            }
        }
Exemplo n.º 9
0
        public virtual void MoveObjects(HttpContext context)
        {
            YZRequest               request    = new YZRequest(context);
            StoreZoneType           zone       = request.GetEnum <StoreZoneType>("zone");
            string                  folder     = request.GetString("folder", null);
            string                  tergetname = request.GetString("tergetname", null);
            MovePosition            position   = request.GetEnum <MovePosition>("position");
            JArray                  post       = request.GetPostData <JArray>();
            BPMObjectNameCollection names      = post.ToObject <BPMObjectNameCollection>();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                cn.MoveObjects(zone, folder, names, tergetname, position);
            }
        }
Exemplo n.º 10
0
        public virtual JObject GetStoreObjectPerms(HttpContext context)
        {
            YZRequest               request  = new YZRequest(context);
            StoreZoneType           zone     = request.GetEnum <StoreZoneType>("zone");
            string                  path     = request.GetString("path", null);
            string                  strPerms = request.GetString("perms", null);
            BPMObjectNameCollection ids      = BPMObjectNameCollection.FromStringList(request.GetString("ids", ""), ',');;

            BPMPermision[] bpmPerms = YZSecurityHelper.ParsePermisions(strPerms);

            JObject rv    = new JObject();
            JObject perms = new JObject();

            rv["perms"] = perms;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                foreach (string id in ids)
                {
                    string fullName;
                    if (String.IsNullOrEmpty(path))
                    {
                        fullName = id;
                    }
                    else
                    {
                        fullName = path + "/" + id;
                    }

                    ACL acl = SecurityManager.GetACL(cn, zone.ToString() + "://" + fullName);

                    JObject jPerm = new JObject();
                    perms[id] = jPerm;

                    foreach (BPMPermision perm in bpmPerms)
                    {
                        jPerm[perm.ToString()] = acl.HasPermision(cn.Token, perm);
                    }
                }
            }

            rv[YZJsonProperty.success] = true;
            return(rv);
        }
Exemplo n.º 11
0
        public virtual object MoveFolders(HttpContext context)
        {
            YZRequest               request    = new YZRequest(context);
            StoreZoneType           zone       = request.GetEnum <StoreZoneType>("zone");
            string                  targetPath = request.GetString("targetPath", null);
            MovePosition            position   = request.GetEnum <MovePosition>("position");
            JArray                  post       = request.GetPostData <JArray>();
            BPMObjectNameCollection paths      = post.ToObject <BPMObjectNameCollection>();

            List <string> rv = new List <string>();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                foreach (string path in paths)
                {
                    rv.Add(cn.MoveFolder(zone, path, targetPath, position));
                }
            }

            return(rv);
        }
Exemplo n.º 12
0
        protected virtual void ExpandTree(BPMConnection cn, JArray items, string path, StoreZoneType zone, bool expand)
        {
            BPMObjectNameCollection folderNames = cn.GetFolders(zone, path, BPMPermision.Read);

            foreach (String folderName in folderNames)
            {
                string folderPath;

                if (String.IsNullOrEmpty(path))
                {
                    folderPath = folderName;
                }
                else
                {
                    folderPath = path + "/" + folderName;
                }

                JObject item = new JObject();
                items.Add(item);
                item["leaf"]     = false;
                item["text"]     = folderName;
                item["iconCls"]  = "folder";
                item["expanded"] = expand;
                item["path"]     = folderPath;
                item["rsid"]     = zone.ToString() + "://" + folderPath;

                JArray children = new JArray();
                item[YZJsonProperty.children] = children;
                this.ExpandTree(cn, children, folderPath, zone, expand);
            }
        }