;;webscript tgenericframe( Assoc taskData )
;;oscript{
Assoc buttonInfo
Assoc section
Dynamic s
List buttonList
String checked
String key
Boolean delegate = False
Boolean review = False
Integer pDelegate = $WFPDelegate
Integer pReview = $WFPReview
Integer pDisposition = $WFPDisposition
Integer pSignature = $WFPSignature
Record taskInfo = taskData.TaskInfo
Assoc permData = taskInfo.SubWorkTask_UserData.PERMFLAGS
Assoc workDone = taskInfo.SubWorkTask_UserData.WORKDONE
Boolean confirm = ( IsDefined( permData ) ) && ( ( permData.PERMISSIONS & pSignature ) == pSignature )
String img = .Img()
String url = .url()
String myURL = $WEBDSP.HTMLPkg.ArgsToURL( .fArgs )
String delReviewURL = Str.Format( '%1?func=work.DelegateReview&xAction=%%1' + \
'&WorkID=%2&SubWorkID=%3&TaskID=%4&NextURL=%%2', \
url, \
taskInfo.SUBWORKTASK_WORKID, \
taskInfo.SUBWORKTASK_SUBWORKID, \
taskInfo.SUBWORKTASK_TASKID )
String editTaskURL = Str.Format( '%1?func=work.edittask&WorkID=%2&SubWorkID=%3&TaskID=%4&NextURL=%5', \
url, \
taskInfo.SUBWORKTASK_WORKID, \
taskInfo.SUBWORKTASK_SUBWORKID, \
taskInfo.SUBWORKTASK_TASKID, \
Web.Escape( .fArgs.NextURL ) )
workDone = ( IsDefined( workDone ) )? workDone : Assoc.CreateAssoc()
Object prgCtx1 = Undefined
Boolean singleUserGroup=False
if (Os.IsFeature( this, "fPrgCtx" ) )
prgCtx1 = .fPrgCtx
end // if
if ( IsDefined( prgCtx1 ) && IsNotError( prgCtx1 ) )
Dynamic userObject = prgCtx1.USession()
if ( IsDefined( userObject ) && IsNotError( userObject ) )
UAPISession uapiSession = userObject.fSession
if ( IsDefined( uapiSession ) && IsNotError( uapiSession ) )
RecArray userInfo = UAPI.GetByID( uapiSession, taskInfo.SUBWORKTASK_PERFORMERID )
if ( IsDefined( userInfo ) && IsNotError( userInfo ) )
String userType = Str.String(userInfo[1].Type)
if (userType=="1")
RecArray groupMembers=UAPI.ChildrenListByID(uapiSession,userInfo[1].Id)
Integer groupMembersLength=Length(groupMembers)
if ((groupMembersLength==1) && (groupMembers[1].Type==UAPI.USER))
singleUserGroup=True
end
end
end
end
end
end
if ( taskData.GroupStep )
delegate = review = False
buttonInfo.Value = [WebWork_HTMLLabel.AcceptThisAssignmentButtonLabel]
buttonInfo.Name = 'IgnoreMe'
buttonInfo.ONCLICK = Str.Format( "document.myForm.xAction.value='Accept'; document.myForm.NextURL.value='%1'; document.myForm.submit();", editTaskURL )
buttonList = { @buttonList, buttonInfo }
buttonInfo = Assoc.CreateAssoc()
buttonInfo.Value = [WebWork_HTMLLabel.DonTAcceptButtonLabel]
buttonInfo.Name = 'IgnoreMe'
buttonInfo.ONCLICK = Str.Format( "document.myForm.xAction.value='NoAccept';document.myForm.NextURL.value='%1';document.myForm.submit();", .fArgs.NextURL )
buttonList = { @buttonList, buttonInfo }
else
if ( IsDefined( permData ) )
delegate = ( ( permData.PERMISSIONS & pDelegate ) == pDelegate )
review = ( ( permData.PERMISSIONS & pReview ) == pReview )
end
if ( IsDefined( permData ) ) &&( ( permData.PERMISSIONS & pDisposition ) == pDisposition )
for s in permData.Dispositions
buttonInfo = Assoc.CreateAssoc()
buttonInfo.Value = s
buttonInfo.Name = 'IgnoreMe'
buttonInfo.ONCLICK = Str.Format( "document.myForm.Disposition.value=%1;SubmitMyPage('%2');", Str.JString( s ), .fArgs.NextURL )
buttonList = { @buttonList, buttonInfo }
end
else
buttonInfo.Value = [WebWork_HTMLLabel.SendOnButtonLabel]
buttonInfo.Name = 'IgnoreMe'
buttonInfo.ONCLICK = Str.Format( "document.myForm.xAction.value='SendOn';SubmitMyPage('%1');", .fArgs.NextURL )
buttonList = { @buttonList, buttonInfo }
end
end
;;}
;if (singleUserGroup)
;end
;;end