protected void PublishNextDocument(object sender, EventArgs e) { WBLogging.Debug("Attempting to publishg the next document " + process.CurrentItemID); process = manager.PublishDocument(process); WBLogging.Debug("Published the document"); DocumentPublishingProgress.WBxUpdateTask(process.LastTaskFeedback); PublishingProcessJSON.Text = WBUtils.SerializeToCompressedJSONForURI(process); WBLogging.Debug("Serialized to: " + PublishingProcessJSON.Text); if (process.HasMoreDocumentsToPublish && process.PublishMode == WBPublishingProcess.PUBLISH_MODE__ALL_TOGETHER) { Image image = (Image)DocumentPublishingProgress.WBxFindNestedControlByID(DocumentPublishingProgress.WBxMakeControlID(process.CurrentItemID, "image")); image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "TriggerNextStepFunction", "WorkBoxFramework_triggerPublishNextDocument();", true); } else { if (process.HasMoreDocumentsToPublish) { WBLogging.Debug("Trying to set button text to Publish next doc"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Publish Next Document');", true); } else { WBLogging.Debug("Trying to set button text to done"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Done');", true); } } }
protected void Page_Load(object sender, EventArgs e) { manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName); if (!IsPostBack) { process = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(Request.QueryString["PublishingProcessJSON"]); process.WorkBox = WorkBox; WBLogging.Debug("Created the WBProcessObject"); PublishingProcessJSON.Text = WBUtils.SerializeToCompressedJSONForURI(process); WBLogging.Debug("Serialized the WBProcessObject to hidden field"); } else { WBLogging.Debug("About to deserialise: " + PublishingProcessJSON.Text); process = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Text); process.WorkBox = WorkBox; } if (process.HasMoreDocumentsToPublish) { if (process.PublishMode == WBPublishingProcess.PUBLISH_MODE__ALL_TOGETHER) { DocumentPublishingProgress.WBxCreateTasksTable(process.ItemIDs, process.MappedFilenames); } else { List <String> oneItem = new List <String>(); oneItem.Add(process.CurrentItemID); Dictionary <String, String> oneMapping = new Dictionary <String, String>(); oneMapping.Add(process.CurrentItemID, process.CurrentItem.Name); DocumentPublishingProgress.WBxCreateTasksTable(oneItem, oneMapping); } Image image = (Image)DocumentPublishingProgress.WBxFindNestedControlByID(DocumentPublishingProgress.WBxMakeControlID(process.CurrentItemID, "image")); image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif"; } }