'From etoys4.0 of 9 October 2008 [latest update: #2332] on 12 October 2009 at 2:36:03 pm'! "Change Set: unknownFix-sw Date: 12 October 2009 Author: Scott Wallace Fix for SQ-510: strange URI for Fraction Bars 31. Correct the uri transformation made when a project previously saved with 'unknown' user gets re-saved on behalf of a registered user."! !Project methodsFor: 'file in/out' stamp: 'sw 10/12/2009 14:35'! storeAttributesOn: aStream "For the manifest: write a series of cr-delimited records of the form : to a stream." | details loggedInAs incomingUser existingUri uri uriPrefix | self storeAttributeKey: 'Squeak-Version' value: SystemVersion current version on: aStream. self storeAttributeKey: 'Squeak-LatestUpdate' value: SystemVersion current highestUpdate printString on: aStream. self storeAttributeKey: 'File-Name-Encoding' value: LanguageEnvironment defaultFileNameConverter class encodingNames first on: aStream. self storeAttributeKey: 'Project-Language' value: Locale current localeID printString on: aStream. loggedInAs := 'unknown'. Utilities loggedIn ifTrue: [ServerDirectory servers at: 'My Squeakland' ifPresent: [:server | loggedInAs := server userPerSe ifNil: ['unknown']]]. incomingUser := self projectParameterAt: #user ifAbsent: ['unknown']. "If the project was loaded from outside, this will be the user associated with that outside version" existingUri := self projectParameterAt: #URI ifAbsent: [nil]. uriPrefix := 'http://squeakland.org/etoys/'. uri := uriPrefix, loggedInAs, '-', Time totalSeconds printString. existingUri ifNotNil: [incomingUser = loggedInAs ifTrue: [uri := existingUri. (self projectParameterAt: #'prev-URI') ifNotNilDo: [:prior | self storeAttributeKey: #'prev-URI' value: prior on: aStream]] ifFalse: [incomingUser = 'unknown' ifTrue: "saved as unknown user, now publishing as registered user; teefal wants new uri but using original epoch in this case." [uri := String streamContents: [:str | str nextPutAll: uriPrefix. str nextPutAll: loggedInAs, '-'. str nextPutAll: (existingUri copyAfterLast: $-)]]. self storeAttributeKey: 'prev-URI' value: existingUri on: aStream]]. self storeAttributeKey: 'URI' value: uri on: aStream. self storeAttributeKey: 'user' value: loggedInAs on: aStream. details _ self world valueOfProperty: #ProjectDetails ifAbsent: [Dictionary new]. Project publishInSexp ifTrue: [ self storeAttributeKey: 'Project-Format' value: 'S-Expression' on: aStream. self storeAttributeKey: 'Project-Format-Version' value: '1.0' on: aStream. ] ifFalse: [ self storeAttributeKey: 'Project-Format' value: 'ImageSegment' on: aStream. ]. details associationsDo: [:assoc | self storeAttributeKey: assoc key asString value: assoc value asString on: aStream.]! !