Support for importing shared workspaces/playground from urls. This could be really important for the workshops :-).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-09-14 11:35:24 +00:00
parent e36e0b3247
commit b4b6270774

View File

@ -135,13 +135,15 @@ GrafoscopioNotebook >> header: anObject [
{ #category : #initialization } { #category : #initialization }
GrafoscopioNotebook >> initializePresenter [ GrafoscopioNotebook >> initializePresenter [
tree whenHighlightedItemChanged: [ :item | tree highlightedItem ifNotNil: [self updateBodyFor: item]]. tree whenHighlightedItemChanged: [ :item |
tree highlightedItem ifNotNil: [self updateBodyFor: item]].
tree whenTreeUpdated: [ :item | item ifNotNil: [self updateBodyFor: item]]. tree whenTreeUpdated: [ :item | item ifNotNil: [self updateBodyFor: item]].
header whenTextChanged: [ :arg | header whenTextChanged: [ :arg |
(tree highlightedItem content header) = arg (tree highlightedItem content header) = arg
ifFalse: [ ifFalse: [
(tree highlightedItem) content header: arg. (tree highlightedItem) content header: arg.
tree roots: tree roots]]. tree roots: tree roots.
self updateForSpecialHeader]].
] ]
{ #category : #initialization } { #category : #initialization }
@ -548,11 +550,27 @@ GrafoscopioNotebook >> updateBodyFor: aNodeContainer [
header text: aNode header. header text: aNode header.
body := self instantiate: aNode specModelClass new. body := self instantiate: aNode specModelClass new.
body content: aNode body. body content: aNode body.
self inform: aNode body.
self autoSaveBodyOf: aNode. self autoSaveBodyOf: aNode.
self buildWithSpecLayout: self class defaultSpec self buildWithSpecLayout: self class defaultSpec
] ]
{ #category : #operation }
GrafoscopioNotebook >> updateForSpecialHeader [
"I see if a node header is an ulr located at 'http://ws.stfx.eu', wich means that is a shared
workspace, and convert the node body to an interactive playground"
| currentNode nodeContent |
currentNode := tree highlightedItem.
currentNode ifNil: [ ^ self ].
nodeContent := currentNode content.
nodeContent header asUrl host = 'ws.stfx.eu'
ifFalse: [ ^ self ].
nodeContent
body: (ZnClient new get: nodeContent header);
tagAs: 'código'.
self updateBodyFor: currentNode
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNotebook >> windowMainMenu [ GrafoscopioNotebook >> windowMainMenu [
^ windowMainMenu ^ windowMainMenu