2013-08-02 1 views
1

Sitecore workbox 명령에서 "Suppress Comment"체크 박스를 선택하지 않고 특정 작업 박스 액션이 실행될 때 팝업에서 주석을달라고 요청할 수 있습니다. 사용자 정의 텍스트를 표시하여 코멘트 입력이 필수임을 사용자에게 알려주고 싶습니다. 이것이 가능한가?Sitecore Workbox 확장 "코멘트 입력"팝업

답변

2

다음은 항목을 거부하는 동안 필수 사항을 설명하는 블로그 게시물입니다. 당신은 쉽게뿐만 아니라 당신의 목적을 위해 사용할 수 있습니다 :

Sitecore workflows – Comment if you reject something!

당신은 사용자가 당신이 Sitecore Workbox.xml 컨트롤을 무시하고 해당 코드에서 뒤에 Comment 방법을 대체 할 수 있습니다 워크 플로우 명령을 실행하려고 시도하기 전에 메시지를 표시해야하는 경우 "Enter a comment:"을 원하는대로 변경하십시오. 원래 메소드 코드는 다음과 같습니다.

public void Comment(ClientPipelineArgs args) 
{ 
    Assert.ArgumentNotNull((object) args, "args"); 
    if (!args.IsPostBack) 
    { 
    Context.ClientPage.ClientResponse.Input("Enter a comment:", string.Empty); 
    args.WaitForPostBack(); 
    } 
    else if (args.Result.Length > 2000) 
    { 
    Context.ClientPage.ClientResponse.ShowError(new Exception(string.Format("The comment is too long.\n\nYou have entered {0} characters.\nA comment cannot contain more than 2000 characters.", (object) args.Result.Length))); 
    Context.ClientPage.ClientResponse.Input("Enter a comment:", string.Empty); 
    args.WaitForPostBack(); 
    } 
    else 
    { 
    if (args.Result == null || !(args.Result != "null") || !(args.Result != "undefined")) 
     return; 
    IWorkflowProvider workflowProvider = Context.ContentDatabase.WorkflowProvider; 
    if (workflowProvider == null) 
     return; 
    IWorkflow workflow = workflowProvider.GetWorkflow(Context.ClientPage.ServerProperties["workflowid"] as string); 
    if (workflow == null) 
     return; 
    Item obj = Context.ContentDatabase.Items[(Context.ClientPage.ServerProperties["id"] ?? (object) string.Empty).ToString(), Language.Parse(Context.ClientPage.ServerProperties["language"] as string), Sitecore.Data.Version.Parse(Context.ClientPage.ServerProperties["version"] as string)]; 
    if (obj == null) 
     return; 
    try 
    { 
     workflow.Execute(Context.ClientPage.ServerProperties["command"] as string, obj, args.Result, true, new object[0]); 
    } 
    catch (WorkflowStateMissingException ex) 
    { 
     SheerResponse.Alert("One or more items could not be processed because their workflow state does not specify the next step.", new string[0]); 
    } 
    UrlString urlString = new UrlString(WebUtil.GetRawUrl()); 
    urlString["reload"] = "1"; 
    Context.ClientPage.ClientResponse.SetLocation(urlString.ToString()); 
    } 
} 
+0

답장을 보내 주셔서 감사합니다. 우리는 실제로 똑같은 일을하고 있습니다. 그러나 클라이언트는 경고 메시지가 별도의 팝업으로 표시되기 때문에 미리 조언을 원합니다. –

+0

@KasunJayasinghe 내 대답을 업데이트했습니다. 지금 귀하의 질문에 대답합니까? –

+0

예 Maras, 완전히 내 질문에 대답합니다. 정말 고맙습니다. –