| 1 | ################################################################################## |
|---|
| 2 | # Copyright (c) 2004-2009 Utah State University, All rights reserved. |
|---|
| 3 | # Portions copyright 2009 Massachusetts Institute of Technology, All rights reserved. |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU General Public License as published by |
|---|
| 7 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU General Public License |
|---|
| 16 | # along with this program; if not, write to the Free Software |
|---|
| 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | # |
|---|
| 19 | ################################################################################## |
|---|
| 20 | |
|---|
| 21 | __author__ = '''Brent Lambert, David Ray, Jon Thomas''' |
|---|
| 22 | __version__ = '$ Revision 0.0 $'[11:-2] |
|---|
| 23 | |
|---|
| 24 | from zope.publisher.browser import BrowserView |
|---|
| 25 | from zope.annotation.interfaces import IAnnotations |
|---|
| 26 | from enpraxis.educommons.interfaces import IClearCopyrightable |
|---|
| 27 | from enpraxis.educommons import eduCommonsMessageFactory as _ |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | class CopyrightView(BrowserView): |
|---|
| 31 | """ Provides view of object with access to annotations in placeless environments""" |
|---|
| 32 | def changeCopyright(self, value): |
|---|
| 33 | """ Provides annotation to placeless script """ |
|---|
| 34 | context = self.context |
|---|
| 35 | message = '' |
|---|
| 36 | if IClearCopyrightable.providedBy(context): |
|---|
| 37 | anno = IAnnotations(context) |
|---|
| 38 | if value == 'True': |
|---|
| 39 | anno['eduCommons.clearcopyright'] = True |
|---|
| 40 | message= _(u'Copyright Cleared') |
|---|
| 41 | elif value == 'False': |
|---|
| 42 | anno['eduCommons.clearcopyright'] = False |
|---|
| 43 | message= _(u'Copyright Revoked') |
|---|
| 44 | return message |
|---|
| 45 | |
|---|
| 46 | |
|---|