"Create a new page" | newPage scheme type | (request fieldsHasKey: 'name') ifTrue: [(book hasPageNamed: (request fieldsKey: 'name')) ifTrue: [response at: 'headerStatus' put: #notFound. book formatBookTemplate: 'addressNotFound' request: request response: response shelf: shelf] ifFalse: ["Add New Page" newPage _ book addNewPage. newPage forbidWriting; date: Date today; time: Time now; name: (request fieldsKey: 'name'); user: 'unknown'. type _ request fieldsKey: 'type' ifAbsent: ['text-default']. (book formatPrivAddress: 'allSchemes' request: request response: response shelf: shelf) do: [:i | ((i at: 1) = (page settingsAt: 'scheme' ifAbsent: ['default'])) ifTrue: [scheme _ i]]. ((scheme at: 4) = 'default') ifFalse: [newPage settingsAt: 'scheme' put: (scheme at: 4)]. (type beginsWith: 'text-') ifTrue: [(type = 'text-default') ifTrue: [newPage text: (book formatPageTemplate: 'newText' request: request response: response shelf: shelf page: newPage)] ifFalse: [newPage text: ''; settingsAt: 'template' put: (type copyFrom: 6 to: type size)]] ifFalse: [ newPage text: ''; settingsAt: 'isText' put: false. (type = 'project-default') ifFalse: [newPage settingsAt: 'template' put: (type copyFrom: 9 to: type size)]]. [newPage user: (shelf formatPrivAddress: 'getIPName' request: request response: response); write; permitWriting] fork. (book pages select: [ :pg | pg textContains: newPage name, '*' caseSensitive: true ]) do: [ :pg | (pg settingsAt: 'isText' ifAbsent: [true]) ifTrue: [[ pg forbidWriting; updateFormatRequest: request response: response shelf: shelf book: book; permitWriting ] fixTemps; fork]]. response at: 'headerStatus' put: #tempMoved. (newPage settingsAt: 'isText' ifAbsent: [true]) ifTrue: [response at: 'location' put: (request referenceShelf: shelf book: book page: newPage address: 'edit')] ifFalse: [response at: 'location' put: (request referenceShelf: shelf book: book page: newPage)]. book formatPageTemplate: 'newSuccess' request: request response: response shelf: shelf page: newPage]] ifFalse: [response at: 'headerStatus' put: #notFound. book formatBookTemplate: 'addressNotFound' request: request response: response shelf: shelf]
((request fieldsHasKey: 'text') or: [request fieldsHasKey: 'text1']) ifTrue: [(page settingsAt: 'lock' ifAbsent: [false]) ifTrue: [(page passwordMatches: request response: response shelf: shelf book: book) ifTrue: [(page isOlderThan: request) ifTrue: ["Write Page" page forbidWriting; clearRefsCache; saveFormat: (request text) request: request response: response shelf: shelf book: book; time: (Time now); date: (Date today); nameUnique: (request fieldsKey: 'name') book: book stripping: '<*@>'; user: 'unknown'; passwordFrom: request response: response shelf: shelf book: book; alertsFrom: request. page user: (shelf formatPrivAddress: 'getIPName' request: request response: response); backup; write; permitWriting; sendAlerts: request response: response shelf: shelf book: book. (book pages select: [ :pg | pg textContains: page name, '*' caseSensitive: true ]) do: [ :pg | (pg settingsAt: 'isText' ifAbsent: [true]) ifTrue: [ pg forbidWriting; updateFormatRequest: request response: response shelf: shelf book: book; permitWriting]]. response at: 'headerStatus' put: #tempMoved. response at: 'location' put: (request referenceShelf: shelf book: book page: page). book formatPageTemplate: 'saveSuccess' request: request response: response shelf: shelf page: page] ifFalse: [book formatPageTemplate: 'editLockedResolve' request: request response: response shelf: shelf page: page]] ifFalse: ["Try Again" book formatPageTemplate: 'saveFailed' request: request response: response shelf: shelf page: (page deepCopy saveFormat: (request text) request: request response: response shelf: shelf book: book; name: (request fieldsKey: 'name'); alertsFrom: request)]] ifFalse: [(page isOlderThan: request) ifTrue: ["Write Page" page forbidWriting; clearRefsCache; saveFormat: (request text) request: request response: response shelf: shelf book: book; time: (Time now); date: (Date today); nameUnique: (request fieldsKey: 'name') book: book stripping: '<*@>'; user: 'unknown'; passwordFrom: request response: response shelf: shelf book: book; alertsFrom: request. page user: (shelf formatPrivAddress: 'getIPName' request: request response: response); backup; write; permitWriting; sendAlerts: request response: response shelf: shelf book: book. (book pages select: [ :pg | pg textContains: page name, '*' caseSensitive: true ]) inspect; do: [ :pg | (pg settingsAt: 'isText' ifAbsent: [true]) ifTrue: [[ pg forbidWriting; updateFormatRequest: request response: response shelf: shelf book: book; permitWriting] fixTemps; fork]]. response at: 'headerStatus' put: #tempMoved. response at: 'location' put: (request referenceShelf: shelf book: book page: page). book formatPageTemplate: 'saveSuccess' request: request response: response shelf: shelf page: page] ifFalse: [book formatPageTemplate: 'editUnlockedResolve' request: request response: response shelf: shelf page: page]]] ifFalse: [response at: 'headerStatus' put: #notFound. book formatBookTemplate: 'addressNotFound' request: request response: response shelf: shelf]
このページを編集 (5775 bytes)
以下の 1 ページから参照されています。 |
This page has been visited 2169 times.