Skip to content

Commit 16d64ce

Browse files
committed
Saving state of v0.9.9c.u1 ... still not quite done
1 parent 4cc1531 commit 16d64ce

File tree

54 files changed

+2939
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2939
-333
lines changed

WBFAnalysisTool/Classes/DataSheet.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public DataSheet(Excel.Workbook workbook, String sheetName, bool writeOnly)
3434

3535
if (!_workbook.xSheetExists(sheetName))
3636
{
37-
Worksheet = _workbook.Worksheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value);
37+
Worksheet = (Excel.Worksheet)_workbook.Worksheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value);
3838
Worksheet.Name = sheetName;
3939
}
4040
else
4141
{
42-
Worksheet = _workbook.Worksheets[sheetName];
42+
Worksheet = (Excel.Worksheet)_workbook.Worksheets[sheetName];
4343
}
4444

4545
TitleRow = new T();

WBFAnalysisTool/Classes/FiguresForOneRecordsType.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void SetRecordsTypeDetails(RecordsTypesDetails recordsTypeDetails)
4949
if (Details == null) return;
5050

5151
if (!String.IsNullOrEmpty(Details["Auto-Close Trigger Date"] as String))
52-
{
52+
{
5353
WBAutoCloseRule = "" + Details["Auto-Close Time Scalar"] + " "+ Details["Auto-Close Time Unit"] + " after " + Details["Auto-Close Trigger Date"];
5454
}
5555
if (!String.IsNullOrEmpty(Details["Retention Trigger Date"] as String))

WBFWebParts/Layouts/WBFWebParts/PublishedDocumentPicker.aspx.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ void ShowResults_PageIndexChanging(object sender, GridViewPageEventArgs e)
608608

609609
private void checkSortState()
610610
{
611-
String sortExpression = ViewState["SortExpression"] as String;
611+
String sortExpression = ViewState["SortExpression"].WBxToString();
612612

613613
sortColumn = WBColumn.GetKnownColumnByInternalName(sortExpression);
614614

WBFWebParts/WebParts/PublicRecordsLibraryViewer/PublicRecordsLibraryViewerUserControl.ascx.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ void ShowResults_PageIndexChanging(object sender, GridViewPageEventArgs e)
580580

581581
private void checkSortState()
582582
{
583-
String sortExpression = ViewState["SortExpression"] as String;
583+
String sortExpression = ViewState["SortExpression"].WBxToString();
584584

585585
sortColumn = WBColumn.GetKnownColumnByInternalName(sortExpression);
586586

WorkBoxFramework/Classes/WBColumn.cs

+23-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ public static WBColumn TextColumn(String displayName, String prettyName)
184184
return textColumn;
185185
}
186186

187+
public static WBColumn TextColumn(String displayName, String internalName, String prettyName)
188+
{
189+
WBColumn textColumn = new WBColumn(displayName, internalName, prettyName, DataTypes.Text);
190+
return textColumn;
191+
}
192+
187193
public static WBColumn UniqueTextColumn(String displayName)
188194
{
189195
WBColumn newColumn = new WBColumn(displayName, INTERNAL_NAME_HAS_NO_SPACE_CHARACTERS, DataTypes.Text);
@@ -347,6 +353,15 @@ public static WBColumn UserColumn(String displayName, bool internalNameHasSpaceC
347353
return column;
348354
}
349355

356+
357+
public static WBColumn UserColumn(String displayName, String internalName, bool allowMultipleValues)
358+
{
359+
WBColumn column = new WBColumn(displayName, internalName, DataTypes.User);
360+
column.AllowMultipleValues = allowMultipleValues;
361+
return column;
362+
}
363+
364+
350365
public static WBColumn LookupColumn(String displayName, bool internalNameHasSpaceCharacters, String lookupListName)
351366
{
352367
WBColumn lookupColumn = new WBColumn(displayName, internalNameHasSpaceCharacters, WBColumn.DataTypes.Lookup);
@@ -848,6 +863,9 @@ private void SetStandardFieldSettings(SPField field, String siteColumnsGroupName
848863
public static readonly WBColumn ID = WBColumn.CounterColumn("ID");
849864
public static readonly WBColumn Author = WBColumn.UserColumn("Author", false, false);
850865

866+
public static readonly WBColumn ModifiedBy = WBColumn.UserColumn("Modified By", "Editor", false);
867+
public static readonly WBColumn CheckInComment = WBColumn.TextColumn("Check In Comment", "_CheckinComment", "Check In Comment");
868+
851869
public static readonly WBColumn ServerURL = WBColumn.TextColumn("ServerUrl", "Server URL");
852870
public static readonly WBColumn EncodedAbsoluteURL = WBColumn.TextColumn("EncodedAbsUrl", "Absolute URL");
853871

@@ -958,6 +976,7 @@ private void SetStandardFieldSettings(SPField field, String siteColumnsGroupName
958976
public static readonly WBColumn PublishedBy = WBColumn.UserColumn("Published By", INTERNAL_NAME_HAS_NO_SPACE_CHARACTERS, false);
959977
public static readonly WBColumn DatePublished = WBColumn.DateTimeColumn("Date Published", "DatePublished", "Published Date");
960978
public static readonly WBColumn ReviewDate = WBColumn.DateTimeColumn("Review Date", "ReviewDate", "Review Date");
979+
public static readonly WBColumn SentNewlyPublishedAlert = WBColumn.DateTimeColumn("Sent Newly Published Alert", "SentNewlyPublishedAlert", "Sent Newly Published Alert");
961980

962981

963982
public static readonly WBColumn FileTypeExtension = WBColumn.UniqueTextColumn("File Type Extension");
@@ -1024,7 +1043,10 @@ private void SetStandardFieldSettings(SPField field, String siteColumnsGroupName
10241043
WBTimerTask.COMMAND__CACHE_WORK_BOX_DETAILS,
10251044
WBTimerTask.COMMAND__UPDATE_RECENTLY_VISITED_WORK_BOXES,
10261045
WBTimerTask.COMMAND__UPDATE_WORK_BOX_DOCUMENTS_METADATA,
1027-
WBTimerTask.COMMAND__PRECREATE_WORK_BOXES
1046+
WBTimerTask.COMMAND__PRECREATE_WORK_BOXES,
1047+
WBTimerTask.COMMAND__SEND_PUBLIC_RECORDS_REVIEW_EMAILS,
1048+
WBTimerTask.COMMAND__AUTO_ARCHIVE_OLD_PUBLIC_RECORDS,
1049+
WBTimerTask.COMMAND__SEND_NEW_PUBLIC_RECORDS_ALERTS
10281050
};
10291051

10301052
public static readonly WBColumn Command = WBColumn.ChoiceColumn(WBTimerTask.COLUMN_NAME__COMMAND, commands);

WorkBoxFramework/Classes/WBDocument.cs

+76-5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public WBDocument(WBRecordsLibrary library, SPListItem item)
4848
DebugName = "<WBDocument>";
4949
}
5050

51+
public WBDocument(WBRecordsLibrary library, SPListItemVersion item)
52+
: base(item)
53+
{
54+
RecordsLibrary = library;
55+
WorkBox = null;
56+
DebugName = "<WBDocument>";
57+
}
58+
5159
public WBDocument(WorkBox workBox, SPListItem item)
5260
: base(item)
5361
{
@@ -56,6 +64,15 @@ public WBDocument(WorkBox workBox, SPListItem item)
5664
DebugName = "<WBDocument>";
5765
}
5866

67+
public WBDocument(WorkBox workBox, SPListItemVersion item)
68+
: base(item)
69+
{
70+
RecordsLibrary = null;
71+
WorkBox = workBox;
72+
DebugName = "<WBDocument>";
73+
}
74+
75+
5976
public WBDocument() : base()
6077
{
6178
RecordsLibrary = null;
@@ -158,7 +175,7 @@ public String AbsoluteURL
158175
{
159176
get
160177
{
161-
if (IsSPListItem) return Item.Web.Url + "/" + Item.Url;
178+
if (IsSPListItem || IsSPListItemVersion) return Item.Web.Url + "/" + Item.Url;
162179
return "";
163180
}
164181
}
@@ -167,7 +184,7 @@ public String LibraryRelativePath
167184
{
168185
get
169186
{
170-
if (IsSPListItem && RecordsLibrary != null)
187+
if ((IsSPListItem || IsSPListItemVersion) && RecordsLibrary != null)
171188
{
172189
WBLogging.Debug("AbsoluteURL = " + AbsoluteURL);
173190
WBLogging.Debug("RecordsLibrary.URL = " + RecordsLibrary.URL);
@@ -245,6 +262,48 @@ public WBTerm SeriesTag
245262
set { this[WBColumn.SeriesTag] = value; }
246263
}
247264

265+
public bool HasDateForFiling
266+
{
267+
get {
268+
//if (HasReferenceDate) return true;
269+
//if (HasDatePublished) return true;
270+
271+
// In the absence of a metadata set value - we'll just use the current date - so we 'have' a usable date:
272+
return true;
273+
}
274+
}
275+
276+
public DateTime DateForFiling
277+
{
278+
get
279+
{
280+
if (HasReferenceDate) return ReferenceDate;
281+
if (HasDatePublished) return DatePublished;
282+
283+
// In the absence of any other appropriate date we'll just return today's date:
284+
return DateTime.Now;
285+
}
286+
}
287+
288+
public bool HasDatePublished { get { return this.IsNotEmpty(WBColumn.DatePublished); } }
289+
public DateTime DatePublished
290+
{
291+
get
292+
{
293+
if (this.IsNullOrEmpty(WBColumn.DatePublished))
294+
{
295+
WBLogging.Generic.Unexpected("Trying to read a 'DatePublished' value of a WBDocument that hasn't been set!!");
296+
return DateTime.Now;
297+
}
298+
299+
return (DateTime)this[WBColumn.DatePublished];
300+
}
301+
set
302+
{
303+
this[WBColumn.DatePublished] = value;
304+
}
305+
}
306+
248307

249308
public bool HasReferenceDate { get { return this.IsNotEmpty(WBColumn.ReferenceDate); } }
250309
public DateTime ReferenceDate
@@ -505,7 +564,7 @@ public Stream OpenBinaryStream()
505564

506565

507566

508-
public bool MaybeUpdateRecordColumns(WBDocument documentToCopy, IEnumerable<WBColumn> columnsToCopy)
567+
public bool MaybeUpdateRecordColumns(String callingUserLogin, WBDocument documentToCopy, IEnumerable<WBColumn> columnsToCopy, String reasonForUpdate)
509568
{
510569
WBLogging.Debug("In MaybeUpdateRecordColumns() for " + DebugName);
511570
bool updateRequired = false;
@@ -536,8 +595,21 @@ public bool MaybeUpdateRecordColumns(WBDocument documentToCopy, IEnumerable<WBCo
536595

537596
if (updateRequired)
538597
{
598+
SPUser callingUser = item.Web.WBxEnsureUserOrNull(callingUserLogin);
599+
600+
if (callingUserLogin != null)
601+
{
602+
WBLogging.Debug("Updating with callingUserLogin = " + callingUserLogin + " and callingUser = " + callingUser.Name);
603+
item.WBxSet(WBColumn.ModifiedBy, callingUserLogin);
604+
item.WBxSet(WBColumn.Modified, DateTime.Now);
605+
}
606+
else
607+
{
608+
WBLogging.Debug("Updating withtout a calling user (callingUserLogin = " + callingUserLogin + ")");
609+
}
610+
539611
item.Update();
540-
item.File.CheckIn("Metadata updated");
612+
item.File.WBxCheckInAs(reasonForUpdate, callingUser);
541613
}
542614
else
543615
{
@@ -550,6 +622,5 @@ public bool MaybeUpdateRecordColumns(WBDocument documentToCopy, IEnumerable<WBCo
550622
return updateRequired;
551623
}
552624

553-
554625
}
555626
}

0 commit comments

Comments
 (0)