## -*- coding: utf_8 -*- <% from fcp import fcpdefs from fcp import mlitem from fcutils import util from fcws.fcweb import webutil from cStringIO import StringIO import base64 %> <%namespace name="toolbar" file="toolbars.html" import="create"/> <% def spitRulesForm(): str = '"FORM":{"ID":20,"13800":{"t":"Enabled","v":1},"13801":"=-1;Receive=0;Send=1;Create=2;Delete=3;Move=4;Open=5;Expiry=6;Modified=7;Reply=8;Forward=9;Manual=10;Read=11;Close=12;Edit=13;Reminder=14;Container Open=15","13806":"Invalid=0;Equals 1=1;Not Equal 1;Equal 2;Not Equal 2;Equal 3;Not Equal 3;Greater Than 1;Less Than 1;Greater Than 2;LessThan 2;Greater Than 3;Less Than 3;Member of Set=21;Not Member of Set;Exists=31;Does Not Exist;Contains=41;Does Not Contain;Starts With=51;Does Not Start With;Ends With=61;Does Not End With;Custom 1=101;Not Custom 1;Custom 2;Not Custom 2;Custom 3;Not Custom 3;Custom 4;Not Custom 4;Custom 5;Not Custom 5;Custom 6;Not Custom 6;Custom 7;Not Custom 7;Custom 8;Not Custom 8;Custom 9;Not Custom 9;Custom 10;Not Custom 10;Custom 11;Not Custom 11;Custom 12;Not Custom 12;Custom 13;Not Custom 13;Custom 14;Not Custom 14;Custom 15;Not Custom 15","13807":"All Criteria;Any Criteria","13810":"----=0;The To list;The Cc list;The Bcc list;The forwarding list;All of the recipients;The sender;Any forwarder;Any To name;Any Cc name;Any Bcc name;Any recipient;The object;The date sent;The date received;The creation date;The last modified date;The expiry date;The size;The name;The subject;The attachment list;Any attachment;The body;The Internet header;The history;The object type;The file type;The form type;The icon;The media type;The field data;A field;Always;Never;When odds are;When the spam level is;When the container;When the user","13830":"=-1;Do nothing=0;Move=1;Copy=2;Delete=3;Generate reply=4;Reject=5;Forward=6;Redirect=7;Send a pager message=8;Send a notification=9;Send a new message=10;Set this item's approval state=11;Set this item's read flag=12;Set this item to open automatically=13;Protect this item from being deleted=14;Make read only=54;Set this item's icon=15;Set this item's color=16;Set this item's priority=17;Set this item's sensitivity=18;Set this item's expiry period=19;Set this item's character set=20;Suppress the default actions=21;Set a string field in this item=22;Set a numeric field in this item=23;Set a date field in this item=24;Play a sound=25;Open an alert box=26;Get confirmation before proceeding=27;Add the selected name to the permissions list=28;Remove the selected name from the permissions list=29;Grant permissions to the selected name=30;Revoke permissions from the selected name=31;Add the selected name to my Contacts folder=32;Remove the selected name from my Contacts folder=33;Subscribe the selected name to a conference=34;Unsubscribe the selected name from a conference=35;Add the selected name to my mail list=36;Remove the selected name from my mail list=37;Add this name to a global mail list=38;Remove this name from a global mail list=39;Add this name to a user group=40;Remove this name from a user group=41;Make a rule log entry=42;Set Subject=43;Stop Rule Processing=44;Run Batch Admin Script=45;Run Helper Application=46;Change Form Type=47;Set Name=48;Link=49;Copy Counter=50;Link Person=51;Open Picker=52;Set Object Type=53;Set View=55"}' return str def spitManagedTasksForm(): str = '"FORM":{"ID":20508,"1012":"-=0;Assigned=6;Acknowledged=7;In Progress=2;Completed=1;Waiting=3;Deferred=4;Cancelled=5"}' return str itemsStrIO = StringIO() jsonStr = '' myMLItem = fcp.MyMLItem thisWebID = myMLItem.WebID() type = myMLItem.Type() subType = myMLItem.SubType() fType,forceColumnarValue = fcp.GetEscapedFormField(13395,0) bForceColumnar = subType==20 or subType==77 or (forceColumnarValue==1 and type == fcpdefs.oMailBox) windowTitle = webutil.stripNone(fcp, fcpdefs.dObjName) nFiles = fcp.NFiles if nFiles==None: nFiles = 0 nFolders = fcp.NFolders if nFolders==None: nFolders = 0 view = fcp.view if view==None: view = 0 nUpperPaneItems = 0 # render for a new window or just add more records bFullPage = False if (Page=='NEXT' or Page=='PREVIOUS' or Page=='ALL') else True bIsThreadListing = True if Thread else False bShowingDeleted = True if Deleted=='' else False if subType==7 or subType==40 or type==fcpdefs.oMailBox: splitType = fcpdefs.viewInfo.splitVertical else: splitType, splitPos, splitPercent = fcp.GetSplitInfo() if Navigator=="1": bIsViewByIcon = True navigatorString = 'fcNavigator="1" ' else: bIsViewByIcon = fcp.IsViewByIcon() if (not bForceColumnar and not bShowingDeleted and subType!=7 and subType!=40 and subType!=66 and type!=fcpdefs.oMailBox) else False navigatorString = '' ratingType = fcp.solicitationMethod if not ratingType: ratingType = 0 parentWebID = myMLItem.ParentWebID() if parentWebID: parentWebIDStr = 'data-x-fcp-parentid="'+parentWebID+'"' else: parentWebIDStr = '' options = fcp.options if options==None: options = 0 if bForceColumnar: options = options | 0x0200 if subList!=None: nItems = len(subList) for i in range(nItems): item = subList[i] if item: itemsStrIO.write(item.AsJSONArrayItem(mlitem.sendAll,(client.serverTZ,client.clientTZ)) + ',') if not item.IsContainer() and item.IsUpperPaneItem(): nUpperPaneItems += 1 else: i = 0 item = fcp.GetNthMLItem(i) while item: itemsStrIO.write(item.AsJSONArrayItem(mlitem.sendAll,(client.serverTZ,client.clientTZ)) + ',') if not item.IsContainer() and item.IsUpperPaneItem(): nUpperPaneItems += 1 i = i + 1 item = fcp.GetNthMLItem(i) if bFullPage: jsonStr += '{"MYMLITEM":'+myMLItem.AsJSONArrayItem(mlitem.sendAll,(client.serverTZ,client.clientTZ))+',"NFILES":'+str(nFiles)+',"NFOLDERS":'+str(nFolders)+',"NUPPERPANEITEMS":'+str(nUpperPaneItems)+',"RIGHTS":'+str(fcp.rights) jsonStr += ',"VIEW":'+str(view)+',"OPTIONS":'+str(options)+',"RATINGTYPE":'+str(ratingType) if subType==29: jsonStr += ','+spitRulesForm() elif subType==77: jsonStr += ','+spitManagedTasksForm() formData = fcp.FormFieldDataAsJSON() if formData!=None: jsonStr += ','+formData else: fType,colLayout = fcp.GetEscapedFormField(13100) if colLayout==None or len(colLayout)==0: fType,colLayout = fcp.GetEscapedFormField(13000) if colLayout and len(colLayout): colLayoutBase64 = base64.standard_b64encode(colLayout) jsonStr += ',"FORMDATA":{"13100":{"b64":"'+colLayoutBase64+'"}}' jsonStr += ',"MLDS":[' else: jsonStr += '{"MLDS":[' strOut = itemsStrIO.getvalue() itemsStrIO.close() lenStrOut = len(strOut) if lenStrOut>0 and strOut[lenStrOut-1]==',': strOut = strOut[0:lenStrOut-1] jsonStr += strOut + ']}' if bFullPage: fldrStyle = '' if nFolders else ' style="display:none;"' upperPaneStyle = '' if nUpperPaneItems else ' style="display:none;"' bIsColumnView = True if Columnar=="1" and (((options & 0x200) != 0 and not (subType==67 or subType==66 or subType==33) and not bShowingDeleted) or (subType==40 or subType==32 or subType==42 or subType==29 or subType==20)) else False bLowerLayoutIsSet = fcp.UseLowerLayout() bUseLowerLayout = True if (bIsColumnView and bLowerLayoutIsSet) or (not bIsColumnView and bLowerLayoutIsSet) else False bSplitView = not bShowingDeleted and not bIsViewByIcon and not subType==16 bHideSplit = bSplitView and (bIsColumnView or subType==67 or subType==66 or subType==33 or subType==20 or type==19) if Retrieve=='SUMMARY': extraData = 'data-x-fc-viewitems="0x0008"' elif bShowingDeleted: extraData = 'data-x-fc-viewitems="0x0007" data-x-fcp-keepopen="true"' elif bIsViewByIcon and navigatorString == '': extraData = 'data-x-fc-viewitems="0x0003"' elif subType==42: extraData = 'data-x-fc-viewitems="0x0007"' elif splitType==fcpdefs.viewInfo.splitNone: extraData = 'data-x-fc-viewitems="0x0003"' else: extraData = '' containerClasses = '' listClasses = ' fc-servobj-view fc-scrolling-view' if bShowingDeleted or bIsThreadListing or subType==42 or type==19: extraData = extraData + ' data-x-fc-getting-more-items=1' wrapperClassList = 'fc-views-wrapper' if bShowingDeleted or subType==42: listClasses += ' fc-only-deleted' if not bShowingDeleted: tbOptions = {'bIsViewByIcon':bIsViewByIcon,'bSplitView':bSplitView,'bHideSplit':bHideSplit,'bShowingDeleted':(bShowingDeleted or subType==42),'nUpperPaneItems':nUpperPaneItems,'bIsColumnView':bIsColumnView,'bIsThreadListing':bIsThreadListing}; toolbar.create(fcp,tbOptions) if subType==66: wrapperData = 'data-x-fc-tab-name="cmd_ShowFeed"' elif subType==33: wrapperData = 'data-x-fc-tab-name="cmd_ShowBlogs"' elif type==19: wrapperData = 'data-x-fc-tab-name="cmd_ShowHitListContent"' extraData = extraData + ' data-x-fcp-updatehandler="FC.updateSearchStatus"' else: wrapperData = '' if fcp.solicitationMethod: extraData = extraData + ' data-x-fcp-ratingtype="'+str(fcp.solicitationMethod)+'"' context.write('