Skip to content

Commit

Permalink
fixed design manager, added repo-manager option 'ignore orphans' (con…
Browse files Browse the repository at this point in the history
…trib by CMeier)

svn path=/ZMS/branches/zms4/; revision=5522
  • Loading branch information
Dr. Frank Hoffmann committed Mar 26, 2020
1 parent b727cb1 commit 4dc5f91
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Products/zms/ZMSMetaobjManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Imports.
from io import BytesIO
from DateTime import DateTime
from distutils.version import LooseVersion
import ZPublisher.HTTPRequest
import collections
Expand Down Expand Up @@ -69,6 +70,8 @@ def icon(self): # obsolete?
absolute_url__roles__=None
def absolute_url(self):
return '#'
def bobobase_modification_time(self):
return DateTime()
artefact = MissingArtefactProxy(attr['id'], attr['type'])
if artefact is not None:
attr['ob'] = artefact
Expand Down
14 changes: 13 additions & 1 deletion Products/zms/ZMSRepositoryManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ def get_last_update(self):
return getattr(self, 'last_update', 0)


"""
Returns ignore-orphans.
"""
def get_ignore_orphans(self):
return getattr(self, 'ignore_orphans', True)


"""
Returns conf-basepath.
"""
Expand Down Expand Up @@ -206,13 +213,17 @@ def traverse(path):
standard.writeLog(self,"[exec_auto_update]: %s seconds needed"%(str(time.time()-current_time)))


def getDiffs(self, provider):
def getDiffs(self, provider, ignore=True):
standard.writeLog(self,"[getDiffs]: provider=%s"%str(provider))
diff = []
local = self.localFiles(provider)
remote = self.remoteFiles(provider)
filenames = sorted(set(list(local)+list(remote)))
for filename in filenames:
if ignore and filename not in local.keys():
# ignore orphaned files in filesystem
# if there are no references in model
continue
l = local.get(filename, {})
r = remote.get(filename, {})
if isinstance(l.get('data', ''),bytes):
Expand Down Expand Up @@ -511,6 +522,7 @@ def manage_change(self, btn, lang, REQUEST=None, RESPONSE=None):
if btn == 'save':
self.auto_update = REQUEST.get('auto_update','')!=''
self.last_update = self.parseLangFmtDate(REQUEST.get('last_update',''))
self.ignore_orphans = REQUEST.get('ignore_orphans','')!=''
self.setConfProperty('ZMS.conf.path',REQUEST.get('basepath',''))
self.update_direction = REQUEST.get('update_direction','Loading')
message = self.getZMILangStr('MSG_CHANGED')
Expand Down
2 changes: 2 additions & 0 deletions Products/zms/zpt/ZMS/manage_customizedesignform.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
fname python:'%s.css'%(css_id.split('.')[-1]);
href python:here.getConfProperty(css_id,'%s/$ZMS_THEME/common/added/%s'%(here.getHome().id,fname));
href python:href.replace('$ZMS_THEME/',[here.getConfProperty('ZMS.theme','')+'/',''][len(here.getConfProperty('ZMS.theme',''))==0]);
href python:href.replace('$ZMS_HOME/',here.getHome().id + '/');
global css python:here.getHome()"
><tal:block tal:repeat="id python:href.split('/')"
><tal:block tal:condition="python:css is not None"
Expand Down Expand Up @@ -211,6 +212,7 @@
fname python:'%s.js'%(js_id.split('.')[-1]);
href python:here.getConfProperty(js_id,'%s/$ZMS_THEME/common/added/%s'%(here.getHome().id,fname));
href python:href.replace('$ZMS_THEME/',[here.getConfProperty('ZMS.theme','')+'/',''][len(here.getConfProperty('ZMS.theme',''))==0]);
href python:href.replace('$ZMS_HOME/',here.getHome().id + '/');
global js python:here.getHome()"
><tal:block tal:repeat="id python:href.split('/')"
><tal:block tal:condition="python:js is not None"
Expand Down
12 changes: 11 additions & 1 deletion Products/zms/zpt/ZMSRepositoryManager/manage_main.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</div><!-- .col-sm-10 -->
</div><!-- .form-group -->
<tal:block
tal:on-error="string:${error/type}: ${error/value}"
tal:on-error="string:${error/type}: ${error/value}"
tal:content="structure python:here.manage_main_diff(here,request)">
the diff
</tal:block>
Expand Down Expand Up @@ -119,6 +119,16 @@
</select>
</div><!-- .col-sm-10 -->
</div><!-- .form-group -->
<div class="form-group row">
<label class="col-sm-2 control-label" title="Ignore files in local filesystem if there are no references in model">
Ignore orphans
</label>
<div class="col-sm-10">
<span class="btn btn-default">
<input type="checkbox" name="ignore_orphans" value="1" tal:attributes="checked python:['','checked'][here.get_ignore_orphans()]" />
</span>
</div>
</div><!-- .form-group -->
<div class="form-group row">
<label class="col-sm-2 control-label" title="Automatic Synchronization of ZMS-Status and File System according to adjusted Update-Direction">
Auto-Sync
Expand Down
2 changes: 1 addition & 1 deletion Products/zms/zpt/ZMSRepositoryManager/manage_main_diff.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
,'/++resource++zms_/jquery/diff/jquery.pretty-text-diff.min.js'
]);
standard modules/Products.zms/standard;
provider_diffs python:[(x,here.getDiffs(x)) for x in here.getRepositoryProviders()];
provider_diffs python:[(x,here.getDiffs(x,here.get_ignore_orphans())) for x in here.getRepositoryProviders()];
provider_diffs_count python:sum([len(x[1]) for x in provider_diffs]+[0])">

<tal:block tal:condition="not:provider_diffs_count">
Expand Down

0 comments on commit 4dc5f91

Please sign in to comment.