Chris Muller uploaded a new version of SMLoader to project The Inbox:
http://source.squeak.org/inbox/SMLoader-cmm.89.mcz ==================== Summary ==================== Name: SMLoader-cmm.89 Author: cmm Time: 16 August 2016, 4:27:27.421151 pm UUID: b29bad6b-f9ed-4209-9c85-b3c70d7ea805 Ancestors: SMLoader-mt.88 Make SMReleaseBrowser support a multi-selection of Squeak Version categories, not just one. The SMServer will still pick just one to be the "primary" Squeak version, which is a questionable behavior. =============== Diff against SMLoader-mt.88 =============== Item was changed: ----- Method: SMPackageRelease>>httpPostContent (in category '*smloader') ----- httpPostContent "Answer the url-encoded parameters for this object." | allCategories | ^ String streamContents: [ : stream | self isNewObject ifTrue: [ "Make the parent release the selected." self parentReleaseIndex > 0 ifTrue: [ stream nextPutAll: '1-1=' , self parentReleaseIndex , '&' ] ] ifFalse: [ "Make this release the selected." self releaseIndex > 0 ifTrue: [ stream nextPutAll: '1-1=' , self releaseIndex , '&' ] ]. "The following category fields must remain in alphabetical order. Add 1 to category indexes because web-server expects the first item to always be nil." stream nextPutAll: '1-3=' , self version asString encodeForHTTP ; nextPutAll: '&1-4=' , (self compatibilityIndex + 1) ; nextPutAll: '&1-5=' , (self licenseIndex + 1) ; nextPutAll: '&1-6=' , (self maturityIndex + 1) ; nextPutAll: '&1-7=' , (self squeakVersionIndex + 1) ; nextPutAll: '&1-8=' , self downloadUrl "already http encoded" ; nextPutAll: '&1-9=1&1-10=&1-11=' "No file selection, 'cool' name or summary". "Specify only the mandatory categories for 'additional categories', otherwise prior mandatory selections will be reflected in the objects categories, causing the highest-in-the-list to always win. Ugh.." allCategories := SMSqueakMap default sortedCategories. {allCategories indexOf: self compatibility. allCategories indexOf: self license. + allCategories indexOf: self maturity} do: - allCategories indexOf: self maturity. - allCategories indexOf: self squeakVersion} do: [ : each | stream nextPutAll: '&1-12=' , each asString ]. + self squeakVersions do: [ : each | stream nextPutAll: '&1-12=', (allCategories indexOf: each) asString ]. self isCommunitySupported ifTrue: [ stream nextPutAll: '&1-12=', (allCategories indexOf: self communitySupportedCategory) asString ]. stream nextPutAll: '&1-13=' , self note asString encodeForHTTP. self isNewObject ifTrue: [ stream nextPutAll: '&1-18=Save+as+new+release' ] ifFalse: [ stream nextPutAll: '&1-17=Save+changes' ]. self parentRelease ifNotNilDo: [ : pr | stream nextPutAll: '&1-19=' , pr releaseIndex ] ]! Item was changed: ----- Method: SMPackageRelease>>initializeMandatoryCategories (in category '*smloader') ----- initializeMandatoryCategories "Set default mandatory categories." self license: self map mit ; + squeakVersions: {self map currentSqueakVersion} ; - squeakVersion: self map currentSqueakVersion ; compatibility: self map onlyExtensions ; maturity: self map alpha! Item was removed: - ----- Method: SMPackageRelease>>squeakVersion (in category '*smloader') ----- - squeakVersion - ^ self categories - detect: - [ : each | each parent = self map squeakVersions ] - ifNone: [ ]! Item was removed: - ----- Method: SMPackageRelease>>squeakVersion: (in category '*smloader') ----- - squeakVersion: aSMCategory - | vers | - aSMCategory parent = self map squeakVersions ifFalse: [ self error: 'Not a squeakVersion category.' ]. - "Remove all squeakVersion-categories." - [ vers := self squeakVersion. - vers notNil ] whileTrue: [ self removeCategory: vers ]. - self addCategory: aSMCategory! Item was changed: ----- Method: SMPackageRelease>>squeakVersionIndex (in category '*smloader') ----- squeakVersionIndex + "Answer my last versions position in the list of my maps squeakVersions." + ^ self map squeakVersions subCategories indexOf: + (self squeakVersions + ifEmpty: [ ^ 0 ] + ifNotEmpty: [ : versions | versions last ])! - "Answer my position in the list of my maps squeakVersions." - ^ self map squeakVersions subCategories indexOf: self squeakVersion! Item was added: + ----- Method: SMPackageRelease>>squeakVersions (in category '*smloader') ----- + squeakVersions + ^ self categories + select: [ : each | each parent = self map squeakVersions ]! Item was added: + ----- Method: SMPackageRelease>>squeakVersions: (in category '*smloader') ----- + squeakVersions: aCollection + aCollection do: + [ : eachVersion | eachVersion parent = self map squeakVersions ifFalse: [ self error: 'Please specify only squeakVersion categories.' ] ]. + "Remove all squeakVersion-categories." + categories copy do: + [ : each | each parent = self map squeakVersions ifTrue: [ self removeCategory: each ] ]. + aCollection do: + [ : each | self addCategory: each ]! Item was changed: CodeHolder subclass: #SMReleaseBrowser + instanceVariableNames: 'release loadScript smClient squeakVersionsSelections' - instanceVariableNames: 'release loadScript smClient' classVariableNames: '' poolDictionaries: '' category: 'SMLoader'! !SMReleaseBrowser commentStamp: 'cmm 1/23/2011 17:44' prior: 0! A browser for specific SqueakMap packages. - Across the top: - version name text input (across the top) - parent release (uneditable text) - Four lists across the width: - license single-select. - versions multi-select. - compatibility single-select. - maturity single-select. X File to upload | elipsis. - Load-script paragraph | Release notes paragraph. - Buttons: - Save. - Cancel. ! Item was added: + ----- Method: SMReleaseBrowser>>allSqueakVersions (in category 'model access') ----- + allSqueakVersions + "Answer all the squeak-versions subcategories." + ^ SMSqueakMap default squeakVersions subCategories! Item was added: + ----- Method: SMReleaseBrowser>>ensureSqueakVersions (in category 'initialize-release') ----- + ensureSqueakVersions + | versions | + versions := self squeakVersions. + (squeakVersionsSelections isNil or: [ squeakVersionsSelections size ~= self allSqueakVersions size ]) ifTrue: + [ squeakVersionsSelections := self allSqueakVersions collect: + [ : each | versions includes: each ] ]! Item was changed: ----- Method: SMReleaseBrowser>>newSqueakVersionSpec: (in category 'toolbuilder') ----- newSqueakVersionSpec: aToolBuilder + ^ aToolBuilder pluggableMultiSelectionListSpec new + model: self ; + name: #squeakVersions ; + help: 'Select the image versions for this release.' ; + autoDeselect: false ; + list: #allSqueakVersions ; + getIndex: #selectedIndex ; + setIndex: #selectedIndex: ; + getSelectionList: #squeakVersionSelectionAt: ; + setSelectionList: #squeakVersionSelectionAt:put: ; + yourself! - ^ aToolBuilder pluggableListSpec new - model: self ; - name: #licenses ; - help: 'Select the image version for this release.' ; - autoDeselect: false ; - list: #squeakVersions ; - getSelected: #squeakVersion ; - setSelected: #squeakVersion: ; - yourself! Item was changed: ----- Method: SMReleaseBrowser>>postInitialize (in category 'initialize-release') ----- postInitialize + self ensureSqueakVersions. (release downloadUrl endsWith: '.st') ifTrue: [ release ensureInCache ifTrue: [ self loadScript: release contents ] ]! Item was added: + ----- Method: SMReleaseBrowser>>selectedIndex (in category 'model access') ----- + selectedIndex + "Required by widget." + ^ 0! Item was added: + ----- Method: SMReleaseBrowser>>selectedIndex: (in category 'model access') ----- + selectedIndex: anIndex + "Required by widget." + self changed: #selectedIndex.! Item was removed: - ----- Method: SMReleaseBrowser>>squeakVersion (in category 'model access') ----- - squeakVersion - ^ release squeakVersion! Item was removed: - ----- Method: SMReleaseBrowser>>squeakVersion: (in category 'model access') ----- - squeakVersion: aSMCategory - release squeakVersion: aSMCategory. - self changed: #squeakVersion! Item was added: + ----- Method: SMReleaseBrowser>>squeakVersionSelectionAt: (in category 'model access') ----- + squeakVersionSelectionAt: anInteger + ^ squeakVersionsSelections at: anInteger! Item was added: + ----- Method: SMReleaseBrowser>>squeakVersionSelectionAt:put: (in category 'model access') ----- + squeakVersionSelectionAt: anInteger put: aBoolean + ^ squeakVersionsSelections at: anInteger put: aBoolean! Item was changed: ----- Method: SMReleaseBrowser>>squeakVersions (in category 'model access') ----- squeakVersions + "Answer the squeak-versions which this release is compatible with." + ^ release squeakVersions! - "Answer the squeak-versions subcategories." - ^ SMSqueakMap default squeakVersions subCategories! Item was added: + ----- Method: SMReleaseBrowser>>squeakVersionsAt: (in category 'model access') ----- + squeakVersionsAt: anInteger + ^ self squeakVersions at: anInteger! Item was added: + ----- Method: SMReleaseBrowser>>squeakVersionsAt:put: (in category 'model access') ----- + squeakVersionsAt: anInteger put: aSMCategory + self squeakVersions halt + at: anInteger + put: aSMCategory. + self changed: #squeakVersions! |
Free forum by Nabble | Edit this page |