|
From: creedon <icr...@us...> - 2005-12-22 18:36:23
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/suites/webEditServer/rpcHandlers/webEdit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18746 Modified Files: modernCheckIn checkIn Log Message: pop file from adrObject for user display Index: checkIn =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/webEditServer/rpcHandlers/webEdit/checkIn,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** checkIn 26 Mar 2005 19:41:17 -0000 1.1.1.1 --- checkIn 22 Dec 2005 18:36:12 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.webEditServer.rpcHandlers.webEdit.checkIn ! on checkIn (userName, password, adrObject, data, objectType, note="") { Ç10/17/98; 11:55:19 AM by DW Çafter the object is stored, loop over the scripts in user.webEditServer.callbacks.checkIn Çthe scripts receive four parameters: Çadrobject -- the address of the object that was checked in Çusername -- the name of the user who checked it in Çnow -- the date/time of the change, every script gets exactly the same time Çdescription -- currently webedit doesn't have support for a description, so I left room for it local (adrPreCallback = @user.webEditServer.callbacks.preCheckIn); local (adrCallback = @user.webEditServer.callbacks.checkIn); local (now = clock.now ()); if not (people.authenticateUser (userName, password, "WebEdit")) { scriptError ("Can't check in " + adrObject + " because an invalid username or password was supplied.")}; adrObject = webEditServer.fixGuestDbAdr (adrObject); ÇMake sure the object is checked out by this user, if the object already exists. if defined (adrObject^) { if not (custody.isCheckedOutByUser (adrObject, userName)) { return ("Can't check in " + adrObject + " because " + userName + " has not checked it out.")}}; data = fatPages.decode (@data); setBinaryType (@data, string4 (objectType)); unpack (@data, @data); webEditServer.callbackLoop (adrPreCallback, adrObject, userName, now, ""); custody.checkIn (userName, password, string (address (adrObject))); table.assign (address (adrObject), data); webEditServer.callbackLoop (adrCallback, adrObject, userName, now, note); ÇAdd to the imported objects log. export.addToLog (adrObject, notes:"From " + username); filemenu.saveMyRoot (adrobject); return (adrObject + " has been checked in.")} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.webEditServer.rpcHandlers.webEdit.checkIn ! on checkIn (userName, password, adrObject, data, objectType, note="") { ÇChanges Ç12/22/05; 9:23:26 AM by TAC Çpop file from adrObject for user display Ç10/17/98; 11:55:19 AM by DW Çafter the object is stored, loop over the scripts in user.webEditServer.callbacks.checkIn Çthe scripts receive four parameters: ÇadrObject -- the address of the object that was checked in Çusername -- the name of the user who checked it in Çnow -- the date/time of the change, every script gets exactly the same time Çdescription -- currently webedit doesn't have support for a description, so I left room for it local (adrPreCallback = @user.webEditServer.callbacks.preCheckIn); local (adrCallback = @user.webEditServer.callbacks.checkIn); local (now = clock.now ()); if not (people.authenticateUser (userName, password, "WebEdit")) { scriptError ("Can't check in " + string.popFileFromAddress (adrObject) + " because an invalid username or password was supplied.")}; adrObject = webEditServer.fixGuestDbAdr (adrObject); ÇMake sure the object is checked out by this user, if the object already exists. if defined (adrObject^) { if not (custody.isCheckedOutByUser (adrObject, userName)) { return ("Can't check in " + string.popFileFromAddress (adrObject) + " because " + userName + " has not checked it out.")}}; data = fatPages.decode (@data); setBinaryType (@data, string4 (objectType)); unpack (@data, @data); webEditServer.callbackLoop (adrPreCallback, adrObject, userName, now, ""); custody.checkIn (userName, password, string (address (adrObject))); table.assign (address (adrObject), data); webEditServer.callbackLoop (adrCallback, adrObject, userName, now, note); ÇAdd to the imported objects log. export.addToLog (adrObject, notes: "From " + username); filemenu.saveMyRoot (adrObject); return (string.popFileFromAddress (adrObject) + " has been checked in.")} \ No newline at end of file Index: modernCheckIn =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/webEditServer/rpcHandlers/webEdit/modernCheckIn,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** modernCheckIn 26 Mar 2005 19:41:18 -0000 1.1.1.1 --- modernCheckIn 22 Dec 2005 18:36:12 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.webEditServer.rpcHandlers.webEdit.modernCheckIn ! on modernCheckIn (userName, password, adrObject, data, objectType, note="") { ÇThis is a new check-in interface. It's modern in that it's cleaner: rather than returning a string indicating success or failure, it returns a struct with information. This check-in interface takes the same arguments as the original check-in interface, which still exists and is still supported. What this interface allows you to do is write your own client-side code for checking in objects. ÇContents of the struct: ÇresultCode -- a number. Ç1 -- successful check-in. Ç2 -- bad username or password. Failure. Ç3 -- checked out by another user. Failure. Ç4 -- parent or grandparent (etc.) is checked out by another user. Failure. Ç5 -- child or grandchild (etc.) is checked out by another user. Failure. Ç6 -- item not checked out. Failure. ÇerrorString -- if successful, it's empty. Otherwise it's a human-friendly error message. ÇresultString -- if successful, a human-friendly success message. ÇcheckedOutBy -- if the object, or ancestor or descendant of the object, is currently checked out (see resultCodes #3, 4, and 5), this is the username of the person who has custody. ÇflCheckedIn -- a simple boolean that indicates success or failure. If resultCode #1, then this is true, otherwise it's false. ÇcheckedOutAncestor -- if resultCode #4, this is the address of the ancestor that's already checked out. ÇcheckedOutDescendant -- if result #5, this is the address of the descendant that's already checked out. ÇIt calls the same callbacks as the older check-in interface. Ç9/24/99; 11:28:35 AM by PBS local (adrPreCallback = @user.webEditServer.callbacks.preCheckIn); local (adrCallback = @user.webEditServer.callbacks.checkIn); local (now = clock.now ()); local (resultTable); //this is the struct that will be returned bundle { //initialize the returned struct new (tableType, @resultTable); resultTable.resultCode = 0; resultTable.errorString = ""; resultTable.resultString = ""; resultTable.checkedOutBy = ""; resultTable.flCheckedIn = false; resultTable.checkedOutAncestor = ""; resultTable.checkedOutDescendant = ""}; if not (people.authenticateUser (userName, password, "WebEdit")) { resultTable.resultCode = 2; resultTable.errorString = "Can't check in " + adrObject + " because an invalid username or password was supplied."; return (resultTable)}; if not (people.authenticateUser (userName, password, "Custody")) { resultTable.resultCode = 2; resultTable.errorString = "Can't check in " + adrObject + " because an invalid username or password was supplied."; return (resultTable)}; adrObject = webEditServer.fixGuestDbAdr (adrObject); on checkForAncestor () { local (adrTable = @user.custody.objects); for i = 1 to sizeOf (adrTable^) { local (adrItem = nameOf (adrTable^ [i])); if defined (adrItem^) { if table.tableContains (adrItem, adrObject) { //found an ancestor resultTable.checkedOutAncestor = adrItem; resultTable.checkedOutBy = adrTable^ [i].user; return (true)}}}; //an ancestor was found return (false)}; on checkForDescendant () { if typeOf (adrObject^) != tableType { return (false)}; local (adrTable = @user.custody.objects); for i = 1 to sizeOf (adrTable^) { local (adrItem = nameOf (adrTable^ [i])); if defined (adrItem^) { if typeOf (adrObject^) == tableType { if table.tableContains (adrObject, adrItem) { //found a descendant resultTable.checkedOutDescendant = adrItem; resultTable.checkedOutBy = adrTable^ [i].user; return (true)}}}}; return (false)}; ÇMake sure the object is checked out by this user, if the object already exists. if defined (adrObject^) { if not (custody.isCheckedOutByUser (adrObject, userName)) { if defined (user.custody.objects.[adrObject]) { //is it checked out by another user? resultTable.resultCode = 3; resultTable.errorString = "Can't check in " + adrObject + " because it's been checked out by another user."; resultTable.checkedOutBy = user.custody.objects.[adrObject].user; return (resultTable)} else { //it hasn't been checked out at all if checkForAncestor () { resultTable.errorString = "Can't check out \"" + adrObject + "\" because a table containing this item is already checked out."; resultTable.resultCode = 4; return (resultTable)}; if checkForDescendant () { resultTable.resultCode = 5; resultTable.errorString = "Can't check out \"" + adrObject + "\" because it contains objects that are already checked out."; return (resultTable)}; resultTable.resultCode = 6; resultTable.errorString = "Can't check in " + adrObject + " because " + userName + " has not checked it out."; return (resultTable)}}} else { //make sure a parent or grandparent (etc.) isn't already checked out if checkForAncestor () { resultTable.errorString = "Can't check out \"" + adrObject + "\" because a table containing this item is already checked out."; resultTable.resultCode = 4; return (resultTable)}}; data = fatPages.decode (@data); setBinaryType (@data, string4 (objectType)); unpack (@data, @data); webEditServer.callbackLoop (adrPreCallback, adrObject, userName, now, ""); custody.checkIn (userName, password, string (address (adrObject))); table.assign (address (adrObject), data); webEditServer.callbackLoop (adrCallback, adrObject, userName, now, note); ÇAdd to the imported objects log. export.addToLog (adrObject, notes:"From " + username); filemenu.saveMyRoot (adrobject); ÇThe check-in was successful. resultTable.resultCode = 1; resultTable.flCheckedIn = true; resultTable.resultString = adrObject + " has been checked in."; return (resultTable)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.webEditServer.rpcHandlers.webEdit.modernCheckIn ! on modernCheckIn (userName, password, adrObject, data, objectType, note="") { ÇChanges Ç12/22/05; 10:01:12 AM by TAC Çpop file from adrObject for user display Ç9/24/99; 11:28:35 AM by PBS Çcreated ÇThis is a new check-in interface. It's modern in that it's cleaner: rather than returning a string indicating success or failure, it returns a struct with information. This check-in interface takes the same arguments as the original check-in interface, which still exists and is still supported. What this interface allows you to do is write your own client-side code for checking in objects. ÇContents of the struct: ÇresultCode -- a number. Ç1 -- successful check-in. Ç2 -- bad username or password. Failure. Ç3 -- checked out by another user. Failure. Ç4 -- parent or grandparent (etc.) is checked out by another user. Failure. Ç5 -- child or grandchild (etc.) is checked out by another user. Failure. Ç6 -- item not checked out. Failure. ÇerrorString -- if successful, it's empty. Otherwise it's a human-friendly error message. ÇresultString -- if successful, a human-friendly success message. ÇcheckedOutBy -- if the object, or ancestor or descendant of the object, is currently checked out (see resultCodes #3, 4, and 5), this is the username of the person who has custody. ÇflCheckedIn -- a simple boolean that indicates success or failure. If resultCode #1, then this is true, otherwise it's false. ÇcheckedOutAncestor -- if resultCode #4, this is the address of the ancestor that's already checked out. ÇcheckedOutDescendant -- if result #5, this is the address of the descendant that's already checked out. ÇIt calls the same callbacks as the older check-in interface. local (adrPreCallback = @user.webEditServer.callbacks.preCheckIn); local (adrCallback = @user.webEditServer.callbacks.checkIn); local (now = clock.now ()); local (resultTable); //this is the struct that will be returned bundle { //initialize the returned struct new (tableType, @resultTable); resultTable.resultCode = 0; resultTable.errorString = ""; resultTable.resultString = ""; resultTable.checkedOutBy = ""; resultTable.flCheckedIn = false; resultTable.checkedOutAncestor = ""; resultTable.checkedOutDescendant = ""}; if not (people.authenticateUser (userName, password, "WebEdit")) { resultTable.resultCode = 2; resultTable.errorString = "Can't check in " + string.popFileFromAddress (adrObject) + " because an invalid username or password was supplied."; return (resultTable)}; if not (people.authenticateUser (userName, password, "Custody")) { resultTable.resultCode = 2; resultTable.errorString = "Can't check in " + string.popFileFromAddress (adrObject) + " because an invalid username or password was supplied."; return (resultTable)}; adrObject = webEditServer.fixGuestDbAdr (adrObject); on checkForAncestor () { local (adrTable = @user.custody.objects); for i = 1 to sizeOf (adrTable^) { local (adrItem = nameOf (adrTable^ [i])); if defined (adrItem^) { if table.tableContains (adrItem, adrObject) { //found an ancestor resultTable.checkedOutAncestor = adrItem; resultTable.checkedOutBy = adrTable^ [i].user; return (true)}}}; //an ancestor was found return (false)}; on checkForDescendant () { if typeOf (adrObject^) != tableType { return (false)}; local (adrTable = @user.custody.objects); for i = 1 to sizeOf (adrTable^) { local (adrItem = nameOf (adrTable^ [i])); if defined (adrItem^) { if typeOf (adrObject^) == tableType { if table.tableContains (adrObject, adrItem) { //found a descendant resultTable.checkedOutDescendant = adrItem; resultTable.checkedOutBy = adrTable^ [i].user; return (true)}}}}; return (false)}; ÇMake sure the object is checked out by this user, if the object already exists. if defined (adrObject^) { if not (custody.isCheckedOutByUser (adrObject, userName)) { if defined (user.custody.objects.[adrObject]) { //is it checked out by another user? resultTable.resultCode = 3; resultTable.errorString = "Can't check in " + string.popFileFromAddress (adrObject) + " because it's been checked out by another user."; resultTable.checkedOutBy = user.custody.objects.[adrObject].user; return (resultTable)} else { //it hasn't been checked out at all if checkForAncestor () { resultTable.errorString = "Can't check out \"" + string.popFileFromAddress (adrObject) + "\" because a table containing this item is already checked out."; resultTable.resultCode = 4; return (resultTable)}; if checkForDescendant () { resultTable.resultCode = 5; resultTable.errorString = "Can't check out \"" + string.popFileFromAddress (adrObject) + "\" because it contains objects that are already checked out."; return (resultTable)}; resultTable.resultCode = 6; resultTable.errorString = "Can't check in " + string.popFileFromAddress (adrObject) + " because " + userName + " has not checked it out."; return (resultTable)}}} else { //make sure a parent or grandparent (etc.) isn't already checked out if checkForAncestor () { resultTable.errorString = "Can't check out \"" + string.popFileFromAddress (adrObject) + "\" because a table containing this item is already checked out."; resultTable.resultCode = 4; return (resultTable)}}; data = fatPages.decode (@data); setBinaryType (@data, string4 (objectType)); unpack (@data, @data); webEditServer.callbackLoop (adrPreCallback, adrObject, userName, now, ""); custody.checkIn (userName, password, string (address (adrObject))); table.assign (address (adrObject), data); webEditServer.callbackLoop (adrCallback, adrObject, userName, now, note); ÇAdd to the imported objects log. export.addToLog (adrObject, notes: "From " + username); filemenu.saveMyRoot (adrObject); ÇThe check-in was successful. resultTable.resultCode = 1; resultTable.flCheckedIn = true; resultTable.resultString = string.popFileFromAddress (adrObject) + " has been checked in."; return (resultTable)} \ No newline at end of file |