Skip to content

Commit

Permalink
added files from master
Browse files Browse the repository at this point in the history
  • Loading branch information
robdayz committed Jul 11, 2018
2 parents 519ab0f + cc69923 commit 0649063
Show file tree
Hide file tree
Showing 24 changed files with 1,299 additions and 822 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __pycache__/
*.so

# Distribution / packaging
bin/
.Python
env/
build/
Expand Down
139 changes: 138 additions & 1 deletion docs/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,149 @@
Changelog
=========

0.16 (unreleased)
0.21 (unreleased)
-----------------

- Nothing changed yet.


0.20 (2018-07-10)
-----------------

* added filename to anon users file [Roberto Diaz]

0.19 (2018-07-10)
-----------------

* removed bin dir with gitignore [Roberto Diaz]
* change translation error [Roberto Diaz]

0.18 (2018-07-10)
-----------------

* changed literal to show better in mobiles [Roberto Diaz]
* changed log messages [Roberto Diaz]
* added logs [Roberto Diaz]
* problems with log hooks [Roberto Diaz]
* added clickable rows [Roberto Diaz]
* addapt code to mobile views [Roberto Diaz]
* cambio literales caja sesion, fecha y hora por fecha, porque en modo movil es muy largo y se muestra mal [Roberto Diaz]
* add responsive view to organgovern template [Roberto Diaz]
* added filename when download private files [Roberto Diaz]
* disable drag and drop in tablets and mobiles [Roberto Diaz]
* added missing classCSS in presentation view [Roberto Diaz]
* added defautl classCSS [Roberto Diaz]

0.17 (2018-06-28)
-----------------

* change CSRF check code [Roberto Diaz]

0.16 (2018-06-27)
-----------------

* permissions_in_og_folders viewg [Roberto Diaz]
* json permissions view [Roberto Diaz]
* new logos to the bridge, until next update [Roberto Diaz]
* hide new search view [Roberto Diaz]
* added missing permission [Roberto Diaz]
* hide new calendar box [Roberto Diaz]
* changed acta membres literal [Roberto Diaz]
* si le ponemos las clases del portlet, no actualiza el ajax al pasar de mes [Roberto Diaz]
* first calendar in main page verions [Roberto Diaz]
* removed fixed path from code [Roberto Diaz]
* trying to skip eggs [Roberto Diaz]
* bos search colors [Roberto Diaz]
* in home not shown results the first tiem, if click the search make query [Roberto Diaz]
* hide gewneb header [Roberto Diaz]
* removed blue color to all days [Roberto Diaz]
* hide order results [root muntanyeta]
* remove unused test [Roberto Diaz]
* show/hide arrow contents depending on user role [Roberto Diaz]
* added translations and change mail receptor in travis temp checks [Roberto Diaz]
* added color to the events of the organ [Roberto Diaz]
* tests temp [Roberto Diaz]
* need change the header and hide the viewlet in production [Roberto Diaz]
* table files shows items well [Roberto Diaz]
* added name when download file [Roberto Diaz]
* problems con unittest [Roberto Diaz]
* problems con unittest [Roberto Diaz]
* added unittest to yml to execute robots tests [Roberto Diaz]
* added robot tests [Roberto Diaz]
* added robot tests [Roberto Diaz]
* calendar translations [Roberto Diaz]
* disable circleCI tests [Roberto Diaz]
* integrating old robot tests [Roberto Diaz]
* adding old robot tests [Roberto Diaz]
* Merge branch 'master' of github.com:UPCnet/genweb.organs [Roberto Diaz]
* error in organs layer name [Roberto Diaz]
* added ulearn calendar template [Roberto Diaz]
* added badge [Roberto Diaz]
* Code to change migrated property. Solved the hasattr property code [Roberto Diaz]
* added paths to search by session [Roberto Diaz]
* added routes to search based on latest session [Roberto Diaz]
* added new calendar portlet [Roberto Diaz]
* coverage exclude dirs [Roberto Diaz]
* added travis and circle options [Roberto Diaz]
* added portlet calendar [Roberto Diaz]
* one functional test [Roberto Diaz]
* added new header logo [Roberto Diaz]
* trabslation [Roberto Diaz]
* added search path to OG [Roberto Diaz]
* fixed coverage versions for travis [Roberto Diaz]
* addapting to travis [Roberto Diaz]
* bypass circleci check [Roberto Diaz]
* added new tests code [Roberto Diaz]
* testing tests [Roberto Diaz]
* TODO: search latest session, and change fixed path in organs search [Roberto Diaz]
* added layer to overrided browser views [Roberto Diaz]
* search: testing last session [Roberto Diaz]
* search: mes recent primer selected [Roberto Diaz]
* change sort_order tipus element in search template [Roberto Diaz]
* Make search in punts and subpunts, showing only punts in template [Roberto Diaz]
* search translations and remove unused and commented code [Roberto Diaz]
* removed fixed paths [Roberto Diaz]
* change permission to utils views [Roberto Diaz]
* Multiple changes. Now shows literal in banner header, in Desktop and Mobile. The items now shows the icons in add... menu, In punts view, the acord now shows labeled status, i18n, and removed references to search2 testing page [Roberto Diaz]
* updated translations [Roberto Diaz]
* solved error, en log no salian los objetos realmente modificados, solo el padre [Roberto Diaz]
* change h1 to h2 to remove added string by js, and changed elif to if [Roberto Diaz]
* first search version [Roberto Diaz]
* added spans [Roberto Diaz]
* testing news search view [Roberto Diaz]
* Update config.yml [Roberto Diaz]
* testing circleci [Roberto Diaz]
* solved print CSS validator error [Roberto Diaz]
* solved CSS validator errors [Roberto Diaz]
* moved barra eines en mode presentacio [Roberto Diaz]
* increase to 50 elements in search [Roberto Diaz]
* added lock icon [Roberto Diaz]
* added c to keyword in css [Roberto Diaz]
* removed file [Roberto Diaz]
* renamed package [Roberto Diaz]
* remove view/method in template [Roberto Diaz]
* Disable custom search because only returns 10 elements [Roberto Diaz]
* updated CSS presentation view [Roberto Diaz]
* cleared presentation file [Roberto Diaz]
* added double custom icons colored to pdf and files [Roberto Diaz]
* testing batch results filtered... [Roberto Diaz]
* testing batch results filtered... [Roberto Diaz]
* added missing templates in previous commit [Roberto Diaz]
* testing new search bar. Problems rendering more than 10 items.. batch... [Roberto Diaz]
* Adding Orgnas test initial concept [Roberto Diaz]
* changing RSS to hide Organs de Govern types, based on state and role [Roberto Diaz]
* secretari now can edit advancedorgan fields [Roberto Diaz]
* added fa-2x in some templates [Roberto Diaz]
* changed PDF view funcionallity [Roberto Diaz]
* temp commit to save info [Roberto Diaz]
* changes [Roberto Diaz]
* testing default template view [Roberto Diaz]
* Merge branch 'master' of github.com:UPCnet/genweb.organs [Roberto Diaz]
* added file public/privat color [Roberto Diaz]
* Created Acords API WS [Roberto Diaz]
* tests [Roberto Diaz]
* ádded dependency [Roberto Diaz]

0.15 (2017-12-21)
-----------------

Expand Down
14 changes: 8 additions & 6 deletions genweb/organs/browser/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ def __call__(self):
try:
entry = api.content.find(path=origin_path, depth=0)[0]
old_id = entry.id
container = entry.getObject().aq_parent
entryobj = entry.getObject()
container = entryobj.aq_parent
chooser = INameChooser(container)
new_id = chooser.chooseName(newvalue, entry.getObject())
new_id = chooser.chooseName(newvalue, entryobj)
change_str = entryobj.absolute_url() + ' - [' + entry.Title + ' → ' + newvalue + ']'
with api.env.adopt_roles(['OG1-Secretari']):
container.manage_renameObject(old_id, new_id)

newObject = api.content.find(id=new_id, path='/'.join(origin_path.split('/')[:-1]))[0]
newObject.getObject().title = newvalue
newObject.getObject().reindexObject()
newobj = newObject.getObject()
newobj.title = newvalue
newobj.reindexObject()

# transaction ok, then write log
recipients = origin_path + ' -> ' + newvalue
addEntryLog(self.context, None, _(u"Changed Title"), recipients)
addEntryLog(self.context, None, _(u"Changed Title"), change_str)
# This line is only to bypass the CSRF WARNING
# WARNING plone.protect error parsing dom, failure to add csrf token to response for url ...
return "Changed Title"
Expand Down
172 changes: 80 additions & 92 deletions genweb/organs/browser/events/removeObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,74 @@
from zope.globalrequest import getRequest
from genweb.organs.utils import addEntryLog
from genweb.organs import _
import transaction


def remove_punt_acord(trans, obj=None, parent=None):
""" Removing punt i subpunt is the same """
portal_catalog = getToolByName(obj, 'portal_catalog')
items = portal_catalog.searchResults(
portal_type=['genweb.organs.punt', 'genweb.organs.acord', 'genweb.organs.subpunt'],
sort_on='getObjPositionInParent',
path={'query': parent.absolute_url_path(),
'depth': 1})
index = 1
sufix = None
# check if second level to assign index value
if obj.aq_parent.portal_type == 'genweb.organs.punt' or obj.aq_parent.portal_type == 'genweb.organs.acord':
sufix = obj.aq_parent.proposalPoint

for item in items:
objecte = item.getObject()
if sufix:
objecte.proposalPoint = str(sufix) + str('.') + str(index)
else:
objecte.proposalPoint = index

if len(objecte.items()) > 0:
search_path = '/'.join(objecte.getPhysicalPath())
values = portal_catalog.searchResults(
portal_type=['genweb.organs.punt', 'genweb.organs.subpunt', 'genweb.organs.acord'],
sort_on='getObjPositionInParent',
path={'query': search_path, 'depth': 1})
subvalue = 1
for value in values:
newobjecte = value.getObject()
if sufix:
newobjecte.proposalPoint = str(sufix) + str('.') + str(subvalue)
else:
newobjecte.proposalPoint = str(index) + str('.') + str(subvalue)
subvalue = subvalue + 1
index = index + 1

if obj.aq_parent.portal_type == 'genweb.organs.punt':
if obj.portal_type == 'genweb.organs.acord':
addEntryLog(obj.aq_parent.aq_parent, None, _(u'Deleted acord'), str(obj.Title()))
else:
if obj.portal_type == 'genweb.organs.acord':
addEntryLog(obj.aq_parent, None, _(u'Deleted acord'), str(obj.Title()))
else:
addEntryLog(obj.aq_parent, None, _(u'Deleted punt'), str(obj.Title()))
transaction.commit()


def remove_subpunt(trans, obj=None, parent=None):
portal_catalog = getToolByName(obj, 'portal_catalog')
items = portal_catalog.searchResults(
portal_type=['genweb.organs.subpunt', 'genweb.organs.acord'],
sort_on='getObjPositionInParent',
path={'query': parent.absolute_url_path(),
'depth': 1})
index = 1
# Assign proposalPoints to acord and subpunts
if items:
sufix = str(items[0].proposalPoint).split('.')[0]
for item in items:
newobjecte = item.getObject()
newobjecte.proposalPoint = str(sufix) + str('.') + str(index)
index = index + 1
addEntryLog(obj.aq_parent.aq_parent, None, _(u'Deleted subpunt'), str(obj.Title()))
transaction.commit()


def deletion_confirmed():
Expand All @@ -30,104 +98,24 @@ def deletion_confirmed():


@grok.subscribe(IPunt, IObjectRemovedEvent)
def removePunt(alias, event):
""" When the alias is created,
TODO make reorder objects fully functional!
"""
def removePunt(obj, event):
""" When the Punt is deleted, reorder proposalPoint field """
if deletion_confirmed():
portal_catalog = getToolByName(alias, 'portal_catalog')
folder_path = '/'.join(alias.__parent__.getPhysicalPath())
addEntryLog(alias.aq_parent, None, _(u'Deleted punt'), alias.absolute_url_path()) # add log
# agafo items ordenats!

puntsOrdered = portal_catalog.searchResults(
portal_type=['genweb.organs.punt'],
sort_on='getObjPositionInParent',
path={'query': folder_path,
'depth': 1})
# hi ha items PUNT per esborrar
if puntsOrdered:
index = 1
for item in puntsOrdered:
objecte = item.getObject()
objecte.proposalPoint = unicode(str(index))
objecte.reindexObject()
if len(objecte.items()) > 0:
search_path = '/'.join(objecte.getPhysicalPath())
subpunts = portal_catalog.searchResults(
portal_type=['genweb.organs.subpunt'],
sort_on='getObjPositionInParent',
path={'query': search_path, 'depth': 1})

subvalue = 1
for value in subpunts:
newobjecte = value.getObject()
newobjecte.proposalPoint = unicode(str(index) + str('.') + str(subvalue))
newobjecte.reindexObject()
subvalue = subvalue + 1
index = index + 1
kwargs = dict(obj=obj, parent=event.oldParent)
transaction.get().addAfterCommitHook(remove_punt_acord, kws=kwargs)


@grok.subscribe(ISubpunt, IObjectRemovedEvent)
def removeSubpunt(alias, event):
"""When the alias is created,
TODO make reorder objects fully functional!
"""
def removeSubpunt(obj, event):
""" When the Subpunt is deleted, reorder proposalPoint field """
if deletion_confirmed():
portal_catalog = getToolByName(alias, 'portal_catalog')
folder_path = '/'.join(alias.__parent__.getPhysicalPath())
addEntryLog(alias, None, _(u'Deleted subpunt'), '') # add log
# agafo items ordenats!
subpuntsOrdered = portal_catalog.searchResults(
portal_type=['genweb.organs.subpunt'],
sort_on='getObjPositionInParent',
path={'query': folder_path,
'depth': 1})

# hi ha items SUBPUNT per esborrar
if subpuntsOrdered:
index = 1
sufix = str(subpuntsOrdered[0].proposalPoint).split('.')[0]
for item in subpuntsOrdered:
item.getObject().proposalPoint = unicode(str(sufix) + str('.') + str(index))
# item.reindexObject()
index = index + 1
kwargs = dict(obj=obj, parent=event.oldParent)
transaction.get().addAfterCommitHook(remove_subpunt, kws=kwargs)


@grok.subscribe(IAcord, IObjectRemovedEvent)
def removeAcord(alias, event):
""" When the alias is created,
TODO make reorder objects fully functional!
"""
def removeAcord(obj, event):
""" When the Acord is deleted, reorder proposalPoint field """
if deletion_confirmed():
portal_catalog = getToolByName(alias, 'portal_catalog')
folder_path = '/'.join(alias.__parent__.getPhysicalPath())
addEntryLog(alias.aq_parent, None, _(u'Deleted acord'), alias.absolute_url_path()) # add log
# agafo items ordenats!

puntsOrdered = portal_catalog.searchResults(
portal_type=['genweb.organs.acord'],
sort_on='getObjPositionInParent',
path={'query': folder_path,
'depth': 1})
# hi ha items PUNT per esborrar
if puntsOrdered:
index = 1
for item in puntsOrdered:
objecte = item.getObject()
objecte.proposalPoint = unicode(str(index))
objecte.reindexObject()
if len(objecte.items()) > 0:
search_path = '/'.join(objecte.getPhysicalPath())
subpunts = portal_catalog.searchResults(
portal_type=['genweb.organs.subpunt'],
sort_on='getObjPositionInParent',
path={'query': search_path, 'depth': 1})

subvalue = 1
for value in subpunts:
newobjecte = value.getObject()
newobjecte.proposalPoint = unicode(str(index) + str('.') + str(subvalue))
newobjecte.reindexObject()
subvalue = subvalue + 1
index = index + 1
kwargs = dict(obj=obj, parent=event.oldParent)
transaction.get().addAfterCommitHook(remove_punt_acord, kws=kwargs)
Loading

0 comments on commit 0649063

Please sign in to comment.