Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate browser resources from senaite.lims #1534

Merged
merged 3 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog

**Added**

- #1534 Integrate browser resources from senaite.lims
- #1529 Moved contentmenu provider into core
- #1523 Moved Installation Screens into core
- #1520 JavaScripts/CSS Integration and Cleanup
Expand Down
2 changes: 2 additions & 0 deletions bika/lims/monkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
#
# Copyright 2018-2020 by it's authors.
# Some rights reserved, see README and LICENSE.

import add_senaite_site # noqa
57 changes: 57 additions & 0 deletions bika/lims/monkey/add_senaite_site.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.CORE.
#
# SENAITE.CORE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2018-2020 by it's authors.
# Some rights reserved, see README and LICENSE.

from OFS.ObjectManager import ObjectManager

ADD_SENAITE_SITE = """
<dtml-if expr="_.len(this().getPhysicalPath()) == 1 and len(objectValues('Plone Site')) == 0">
<script type="text/javascript">
var url = location.href.replace(location.pathname, "/@@senaite-addsite?site_id=senaite")
location.href = url;
</script>
</dtml-if>
<dtml-if expr="_.len(this().getPhysicalPath()) == 1 and len(objectValues('Plone Site')) > 0">
<!-- Add Plone site action-->
<style type="text/css">
.form { margin: 1em auto; text-align:center; }
.button {padding:1em 3em;background-color:#337ab7;color:#fff;border-color:#2e6da4;cursor:pointer;font-weight:bold; }
input[value='Add Plone Site'] { display:none; }
</style>
<form class="form"
method="get"
action="&dtml-URL1;/@@senaite-addsite"
target="_top">
<input type="hidden" name="site_id" value="senaite" />
<input class="button" type="submit" value="Install SENAITE LIMS" />
</form>
</dtml-if>
"""

main = ObjectManager.manage_main
orig = main.read()
pos = orig.find('<!-- Add object widget -->')


# Add in our button html at the right position
new = orig[:pos] + ADD_SENAITE_SITE + orig[pos:]

# Modify the manage_main
main.edited_source = new
main._v_cooked = main.cook()
7 changes: 7 additions & 0 deletions bika/lims/monkey/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
xmlns:monkey="http://namespaces.plone.org/monkey"
i18n_domain="senaite.core">

<!-- Make overlayhelpers.js compatible with jQuery > 1.9
https://github.com/senaite/senaite.lims/issues/21 -->
<browser:resource
name="plone.app.jquerytools.overlayhelpers.js"
file="overlayhelpers.js"
layer="bika.lims.interfaces.IBikaLIMS"/>

<monkey:patch
description="This adds the bika.lims category to controlpanel-overview."
class="plone.app.controlpanel.overview.OverviewControlPanel"
Expand Down
Loading