diff -r -u MoinMoin.orig/PageEditor.py MoinMoin/PageEditor.py --- MoinMoin.orig/PageEditor.py 2006-03-05 10:41:11.533854400 -0800 +++ MoinMoin/PageEditor.py 2006-03-05 18:37:02.346659200 -0800 @@ -136,7 +136,28 @@ edit_lock_message = None preview = kw.get('preview', None) staytop = kw.get('staytop', 0) + + # for section editing + issectionedit = kw.get('issectionedit', 1) + pagetext = kw.get('pagetext', None) + startline = int(form.get('startline', ['0'])[0]) + endline = int(form.get('endline', ['0'])[0]) + srev = int(form.get('srev', ['0'])[0]) + + if startline or endline: + if not startline: + startline = 1 + + if not endline: + endline = -1 + else: + issectionedit = 0 + if issectionedit: + # need to add config + self._allow_section_edit = self.cfg.allow_section_edit + # self._allow_section_edit = 1 + from MoinMoin.formatter.text_html import Formatter self.request.formatter = Formatter(self.request, store_pagelinks=1) @@ -175,7 +196,10 @@ title = _('Edit "%(pagename)s"') else: title = _('Preview of "%(pagename)s"') - self.set_raw_body(preview, modified=1) + if issectionedit and pagetext is not None: + self.set_raw_body(pagetext, modified=1) + else: + self.set_raw_body(preview, modified=1) # send header stuff lock_timeout = self.lock.timeout / 60 @@ -215,9 +239,19 @@ # We don't show preview when in conflict preview = None + # no section-editing any more + if issectionedit: + conflict_msg = u'%s %s' % (conflict_msg, _('Section editing is canceled.')) + issectionedit = 0 + elif self.exists(): # revision of existing page rev = self.current_rev() + + if issectionedit and preview is None: + if not (srev and srev == rev): + conflict_msg = u'%s %s' % (_('Section editing is canceled.'), _('Someone else updated this page. You are editing the updated revision.')) + issectionedit = 0 else: # page creation rev = 0 @@ -275,6 +309,12 @@ # Generate default content for new pages if not raw_body: raw_body = _('Describe %s here.') % (self.page_name,) + elif issectionedit: + # for section editing + if pagetext is not None: + raw_body = preview + else: + raw_body = self.fetchsection(raw_body, startline, endline) # send form self.request.write('