Untitled

 avatar
unknown
plain_text
22 days ago
5.1 kB
2
Indexable
base.ItemUpdated(properties);
			string siteUrl = properties.Web.Url;
			SPUser currentUser = properties.Web.CurrentUser;
			bool removeOldAuthors = false;
			bool remobeOldLectors = false;
			SPUtility.ValidateFormDigest();
			SPSecurity.RunWithElevatedPrivileges(delegate()
			{
				using (SPSite spsite = new SPSite(siteUrl))
				{
					using (SPWeb spweb = spsite.OpenWeb())
					{
						SPListItem itemById = spweb.Lists[properties.ListTitle].GetItemById(properties.ListItemId);
						bool flag = itemById.Folder != null;
						if (flag)
						{
							string text = properties.ListItem["InstructionStatus"].ToString();
							string b = properties.BeforeProperties["InstructionStatus"].ToString();
							itemById.ProgId = "SharePoint.DocumentSet";
							bool flag2 = itemById["InstructionOld"] != null && Convert.ToBoolean(itemById["InstructionOld"].ToString());
							bool flag3 = !flag2;
							if (flag3)
							{
								bool flag4 = text != b;
								if (flag4)
								{
									bool flag5 = text == "Nacrt upute" || text == "Lektorirana uputa" || text == "Potpisana uputa" || text == "Parafirana uputa" || text == "Potpisnik vratio na doradu" || text == "Kontrolor vratio na doradu";
									if (flag5)
									{
										bool flag6 = text == "Nacrt upute" || text == "Lektorirana uputa" || text == "Kontrolor vratio na doradu" || text == "Potpisnik vratio na doradu" || text.Contains("na doradu");
										if (flag6)
										{
											this.UpdateRightsStatusChanged("InstructionAuthors", 6, spweb, itemById, properties, "");
										}
										else
										{
											this.UpdateRightsStatusChanged("InstructionAuthors", 2, spweb, itemById, properties, "");
										}
									}
									else
									{
										this.UpdateRightsStatusChanged("InstructionAuthors", 2, spweb, itemById, properties, "InstructionLectors");
										this.UpdateRightsStatusChanged("InstructionAuthors", 2, spweb, itemById, properties, "");
									}
									this.GetAllFiles(itemById, properties.List, text, spweb, properties);
								}
								else
								{
									object obj = properties.BeforeProperties["InstructionAuthors"];
									bool flag7 = obj != null;
									if (flag7)
									{
										bool flag8 = properties.BeforeProperties["InstructionAuthors"].ToString() != "";
										if (flag8)
										{
											obj = properties.BeforeProperties["InstructionAuthors"];
										}
									}
									object obj2 = properties.BeforeProperties["InstructionLectors"];
									bool flag9 = obj != null;
									if (flag9)
									{
										bool flag10 = properties.BeforeProperties["InstructionLectors"].ToString() != "";
										if (flag10)
										{
											obj = properties.BeforeProperties["InstructionLectors"];
										}
									}
									bool flag11 = properties.ListItem["InstructionAuthors"] != obj;
									if (flag11)
									{
										bool flag12 = true;
										bool flag13 = text == "Nacrt upute" || text == "Lektorirana uputa" || text == "Potpisnik vratio na doradu" || text == "Kontrolor vratio na doradu";
										if (flag13)
										{
											flag12 = false;
										}
										this.UpdateRights("InstructionAuthors", flag12 ? 2 : 6, spweb, itemById, properties, text);
										removeOldAuthors = true;
									}
									bool flag14 = properties.ListItem["InstructionLectors"] != obj2;
									if (flag14)
									{
										bool flag15 = true;
										this.UpdateRights("InstructionLectors", flag15 ? 2 : 3, spweb, itemById, properties, text);
										remobeOldLectors = true;
									}
								}
								this.SetAuthorsRights(properties, text, spweb, itemById);
							}
							bool flag16 = text == "Aktivirana uputa";
							if (flag16)
							{
								this.UpdateRightsStatusChanged("InstructionAuthors", 2, spweb, itemById, properties, "");
								SPFieldUserValue spfieldUserValue = new SPFieldUserValue(spweb, itemById[SPBuiltInFieldId.Author].ToString());
								SPUser user = spfieldUserValue.User;
								itemById.RoleAssignments.Remove(user);
								SPHelper.SetItemPermission(itemById, 2, user);
							}
							SPUser spuser = null;
							bool flag17 = properties.ListItem["InstructionPersonModefiedBy"] != null;
							if (flag17)
							{
								SPFieldUserValue spfieldUserValue2 = new SPFieldUserValue(spweb, properties.ListItem["InstructionPersonModefiedBy"].ToString());
								spuser = spfieldUserValue2.User;
							}
							else
							{
								spuser = currentUser;
							}
							this.EventFiringEnabled = false;
							DocumentSet documentSet = DocumentSet.GetDocumentSet(itemById.Folder);
							SPFileCollection files = documentSet.Folder.Files;
							foreach (object obj3 in files)
							{
								SPFile spfile = (SPFile)obj3;
								SPListItem itemById2 = spfile.DocumentLibrary.GetItemById(spfile.Item.ID);
							}
							itemById.Update();
							documentSet.VersionCollection.Add(true, spuser.Name);
							this.EventFiringEnabled = false;
						}
					}
				}
			});
Leave a Comment