Code Monkey home page Code Monkey logo

africanlii / liiweb Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 133.33 MB

Drupal-based LII website powering free access to law portals publishing caselaw, legislation, government gazettes and journal articles. Developed by AfricanLII at the University of Cape Town and Laws.Africa

License: GNU Lesser General Public License v3.0

PHP 85.93% JavaScript 5.92% CSS 5.41% HTML 0.63% Shell 0.13% Twig 1.79% SCSS 0.18% Makefile 0.01% Ruby 0.01% Less 0.01% Procfile 0.01%
drupal composer legaltech legal-texts

liiweb's People

Contributors

adolflategan avatar ashra-fomar avatar cristiroma avatar dependabot[bot] avatar hayk-web avatar jimz0r avatar longhotsummer avatar mariyabb avatar musangowope avatar roger-cts avatar rwsiteadmin avatar stefanbutura avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

liiweb's Issues

Include the consolidation date as a point in time on the Legislation Timeline

See the attached image. For consolidations imported without retrospective Gazette research, include the consolidation date (for Uganda - 31 Dec 2000) as a point on the Legislation timeline of the individual acts. Discussed with Edith and she suggests that the change should happen on LIIweb rather than Indigo (i.e. NOT make consolidation date a point in time on Indigo)

CaptureTimeline

Need a mechanism to host images on a per-expression basis

The HTML for an expression may contain image links, such as <img src="media/foo.png">. This should show the correct foo.png file associated with the expression. Different expressions for the same work may have different foo.png files, and different works may also have files named foo.png.

A url such as https://example.com/akn/za/act/2009/5/eng@2019-01-01/media/foo.png would be ideal. However, if necessary, we can also rewrite the media urls easily. So we could use a different prefix such as https://example.com/files/media/akn-za-act-2009-5-eng-2019-01-01/foo.png.

So two key requirements:

  • files need to be scoped to the expression with which they're linked
  • the images need to be able to load via normal html img tags

Unexpected error on ULII Supreme Court 1981 judgments

Click on either of the two judgments https://new.ulii.org/judgments/UGSC/1981 and error appears

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\liiweb\LiiWebUtils::getLatestFrbrUriForNode() must implement interface Drupal\node\NodeInterface, null given, called in /app/web/modules/custom/liiweb_api/src/PathProcessor/LiiWebPathProcessorAlias.php on line 44 in Drupal\liiweb\LiiWebUtils->getLatestFrbrUriForNode() (line 134 of modules/custom/liiweb/src/LiiWebUtils.php).

image

Initial deployment fails because checks try to run

When first deploying (before the database is setup), the first deployment fails because the postdeploy script runs and tries to interact with the database.

We could add a config setting that disables the scripts on the first deployment?

Protect the Judgment number override box

It is easy to accidentally add a number in the judgment number override box. The box should be moved to another tab, or a checkbox added next to it to add another step before the automatic judgment number assignment is overridden.

BUG when uploading a file for a gazette

When POSTing a file to /jsonapi/node/government_gazette/XXX/field_file, the server returns a 500 response:

LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\Core\Cache\CacheableResponse. in Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (line 154 of /Users/greg/coding/laws.africa/liiweb/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php).

  • Disabling the filefield_paths module for that field removes the issue.
  • This occurs whether we use s3 storage or local storage.
  • Occurs if I create a single file field on another content type
  • Does NOT occur on the legislation content type's multiple file field

Do we need file field paths for this field? Can we turn it off? Can we fix this?

Include section number in the link of a section / part / chapter in the TOC

As a user of legislation, I would like to easily view the section number in addition to the heading of a section in the TOC of legislation. Legislation is cited with a section number more frequently than with the full section heading

Include section number in the TOC of legislation, so each link to a section is preceded with the section number
image

As a user I would like to search content on the site

  • solr server
  • search box in navbar
  • search box on homepage
  • search results page

If this page is complex to put together, then we may want to delay it (or make it very simple) until we can implement a richer design.

Posting to REST endpoint with application/vnd.api+json as Accept header does not work

When I query the service with correct Accept header:

curl --fail -H "Accept: application/vnd.api+json" -u user:pass http://example.com/akn/za/act/1900/00/eng@1900-01-01

The call fails with 403, however when I'm sending application/json it works:

curl --fail -H "Accept: application/json" -u user:pass http://example.com/akn/za/act/1900/00/eng@1900-01-01

I did some debugging without success, also found few issues might help:

Uploading PDFs for legislation returns an error

The site contains a legislation node type. A piece of legislation can change over time, and we store the different legislation versions as different Drupal revisions for a node. A developer wrote an adjustment to the Drupal REST API to allow us to read and update the revisions easily. Without the REST API, we cannot update historical versions of a piece of legislation.

The API is documented here: https://github.com/africanlii/liiweb/tree/master/docs/jsonapi

A specific URL format allows us to update different versions. For example:

We associate a PDF version of each piece of legislation. Each historical version has its own PDF version.

We upload a PDF in two steps (see documentation here):

  1. upload the file to get a file ID
  2. attach the file to an existing node

The files are stored in S3.

The bug

When we try to attach a file to an existing node (step 2), we get this error:

LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\jsonapi\ResourceResponse. in Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (line 154 of /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php).

You can follow the instructions at https://github.com/africanlii/liiweb/tree/master/docs/jsonapi#attaching-files-to-an-expression to reproduce the bug

Remove drupal core from this repo

There's no reason to have drupal core committed to the repo. It can be installed with composer like everything else.

We probably want to look at removing it from the full repo history, too, to slim down the repo size.

See also #136

Setup URL for legislation nodes to be the FR BR URIs

The FRBR URIs need to be integrated in Drupal, so that when nodes are rendered in any context (i.e. views, search etc.) they are rendered as links to their FRBR URI.

  • Current revisions of nodes create via API will inherit the FRBR as URL alias
  • URL handler pattern to server the correct node / revision
  • Write tests which invokes API and creates works and expressions and test the URIs are correct

FRBR URI urls don't always work

Doing a GET or an api-based PATCH to an FRBR URI returns a 404.

It works for an FRBR URI such as:

/akn/za/1993/3/eng@1993-01-03

but not

/akn/za/act/1993/3/eng@1993-01-03

Note that the first example isn't a valid FRBR URI, whereas the second one is.

If possible, I suggest that the URI-matching code looks for /akn/ and then just blindly tries to find a matching node in the database. Parsing the FRBR URIs is complicated, because there are a number of optional parts to it. eg. /akn/za/act/1993/3, /akn/za-cpt/act/by-law/1993/3 and /akn/za-cpt/act/gn/1993-02-01/3 are all valid.

REST API endpoint to interact with legislation works and expressions

Currently the support in Drupal core to create translations and revisions is limited. There is a 3-years old discussion on how to implement this in JSON APIs with no clear solution foreseen since it has implications to the Drupal core: mainly because it is difficult to handle all edge cases in a generic way. Moreover, now JSON API is part of the Drupal core and we cannot just patch the module because it may block future core (security) updates.

Therefore the solution suggested is to create our own custom REST endpoint which allows handling both multilingual an revisions according to the project needs. Later, if there's another solution provided by the Drupal core, these endpoints can either be removed or preserved as a thin layer between the external tool and core REST API. Even so, the solution provided would be lightweight since it will handle exactly our use-case and it doesn't require to be generic.

References:

Display as Published date for content

Older cases are being added on the platform and it is difficult for users to find them as there is no sorting or indication on the actual documents that allows a view into the most recently added cases. Devise a UI to resolve this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.