PHP Classes
elePHPant
Icontem

Polr Admin Dashboard: Another admin dashboard for the Polr URL shortener

Recommend this page to a friend!
  Info   View files Documentation   Demos   View files View files (43)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-12-10 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 78 All time: 8,973 This week: 617Up
Version License PHP version Categories
polr-admin 0.1.0GNU General Publi...5PHP 5, Content management
Description Author

This package implements another admin dashboard for the Polr URL shortener.

The features are mostly the same as in the Polr Admin section, but with few differences.

- The link redirection feature is not included
- The dashboard is based on Laravel instead of Lumen
- AngularJS is dropped in favor of Jaxon
- A Confirm Password field is added to the Change Password form
- The URL shortening and link stats features are fully implemented with AJAX, using Jaxon

  Performance   Level  
Name: Thierry Feuzeu <contact>
Classes: 12 packages by
Country: Cameroon Cameroon
Innovation award
Innovation award
Nominee: 1x

Details

Polr Admin

An alternative admin dashboard for the Polr URL shortener.

The goal is to provide a dashboard for managing multiple Polr instances.

This dashboard is packaged as a Jaxon extension, so it can be installed on any running PHP web application.

The Polr API package needs to be installed on each instance of Polr to be managed.

Features

The features are mostly the same as Polr, but with few differences.

  • The Settings tab allows to choose a Polr instance from a dropdown list.
  • The dashboard can display stats for all links.
  • The user creation and deletion, link redirection and password change features are not included.
  • AngularJS is dropped in favor of Jaxon https://www.jaxon-php.org.
  • The package is a Jaxon extension, and not a standalone application.
  • All features are fully implemented with Ajax, using Jaxon.

Jaxon package

Depending on the PHP framework used by the application, a different Jaxon package must be installed and configured together with Polr Admin.

Jaxon packages exist for the following frameworks:

In the case an unsupported framework (or no framework) is used, the Armada package must be installed instead.

The Jaxon packages are documented online.

The following example uses to the Laravel framework, but the same principles apply to other frameworks.

Installation

Add the package in the composer.json file, and run composer update.

{
    "require": {
        "jaxon-php/jaxon-laravel": "~2.0",
        "lagdo/polr-admin": "dev-master"
    }
}

This package uses the Blade template engine to display its views. As a consequence, when using a framework other than Laravel, the Blade package for Jaxon must also be installed.

{
    "require": {
        "jaxon-php/jaxon-codeigniter": "~2.0",
        "jaxon-php/jaxon-blade": "~2.0",
        "lagdo/polr-admin": "dev-master"
    }
}

Add Jaxon to the providers entries in app.php.

    'providers' => [
        // ...
        // Jaxon Ajax library
        Jaxon\Laravel\JaxonServiceProvider::class,
    ],

Publish the public files.

php artisan vendor:publish --tag=public --force

Publish the config files.

php artisan vendor:publish --provider="Jaxon\Laravel\JaxonServiceProvider" --tag="config"

This will create the jaxon.php files in the config dir.

Configuration

Manually create and edit the config/polradmin.php config file, to list the Polr intances to be managed.

return [
    'default' => 'first',
    'endpoints' => [
        'first' => [
            'name'       => 'First Instance', // The name of this instance for dropdown menu
            'url'        => 'http://polr.domain.com',
            'api'        => 'api/v2',
            'key'        => 'PolrApiKey', // The user API key on the Polr instance
        ],
    ],
];

Page template

The package provides various functions returning the HTML, Javascript and CSS codes to be inserted into a template.

Let's consider the following Laravel controller, where the Jaxon instance is injected in the index() method and passed to a template.

use Jaxon\Laravel\Jaxon;
use Lagdo\Polr\Admin\PolrAdmin;

class PolrController extends Controller
{
    public function index(Jaxon $jaxon)
    {
        // Get the Polr Admin instance
        $polr = $jaxon->package('polr.admin');
        // Load the Polr Admin configuration
        $polr->config(config_path('polradmin.php'));

        // Register Jaxon classes
        $jaxon->register();

        return view('index', ['jaxon' => $jaxon, 'polr' => $polr]);
    }
}

The following calls will return the codes to be inserted in the template.

  • $jaxon->css(): The Jaxon CSS includes.
  • $jaxon->js(): The Jaxon Javascript includes.
  • $jaxon->script(): The Jaxon Javascript code.
  • $polr->css(): The Polr Admin CSS includes.
  • $polr->js(): The Polr Admin Javascript includes.
  • $polr->html(): The Polr Admin HTML code.
  • $polr->ready(): The Javascript code to run on page ready.

So a sample template will look like this.

@extends('layouts.base')

@section('css')
{!! $jaxon->css() !!}

{!! $polr->css() !!}
@endsection

@section('content')

{!! $polr->html() !!}

@endsection

@section('js')
{!! $jaxon->js() !!}
{!! $jaxon->script() !!}

{!! $polr->js() !!}

<script type="text/javascript">
$(document).ready(function() {
    {!! $polr->ready() !!}
});
</script>
@endsection

Notice for other frameworks

When using a framework other than Laravel, the Jaxon object is an instance of a different class. The config file path (maybe its format too), the controller and the template engine are also different.

  Polr Admin with SonataExternal page  
  Files folder image Files  
File Role Description
Files folder imageconfig (2 files)
Files folder imageresources (2 directories)
Files folder imagesrc (2 files, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file jaxon.php Aux. Auxiliary script
  Accessible without login Plain text file polr.php Aux. Auxiliary script

  Files folder image Files  /  resources  
File Role Description
Files folder imageassets (2 directories)
Files folder imageviews (4 files, 4 directories)

  Files folder image Files  /  resources  /  assets  
File Role Description
Files folder imagecss (4 files)
Files folder imagejs (5 files)

  Files folder image Files  /  resources  /  assets  /  css  
File Role Description
  Accessible without login Plain text file admin.css Data Auxiliary data
  Accessible without login Plain text file base.css Data Auxiliary data
  Accessible without login Plain text file index.css Data Auxiliary data
  Accessible without login Plain text file stats.css Data Auxiliary data

  Files folder image Files  /  resources  /  assets  /  js  
File Role Description
  Accessible without login Plain text file base.js Data Auxiliary data
  Accessible without login Plain text file home.js Data Auxiliary data
  Accessible without login Plain text file jquery-jvectormap-world-mill.js Data Auxiliary data
  Accessible without login Plain text file jquery-jvectormap.min.js Data Auxiliary data
  Accessible without login Plain text file stats.js Data Auxiliary data

  Files folder image Files  /  resources  /  views  
File Role Description
Files folder imageshorten (1 file)
Files folder imagesnippets (6 files)
Files folder imagestats (2 files, 1 directory)
Files folder imagetabs (6 files)
  Accessible without login Plain text file css.blade.php Aux. Auxiliary script
  Accessible without login Plain text file default.blade.php Aux. Auxiliary script
  Accessible without login Plain text file js.blade.php Aux. Auxiliary script
  Accessible without login Plain text file polr.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  shorten  
File Role Description
  Accessible without login Plain text file result.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  snippets  
File Role Description
  Accessible without login Plain text file edit_long_url.blade.php Aux. Auxiliary script
  Accessible without login Plain text file edit_user_api_info.blade.php Aux. Auxiliary script
  Accessible without login Plain text file js.blade.php Aux. Auxiliary script
  Accessible without login Plain text file link_table.blade.php Aux. Auxiliary script
  Accessible without login Plain text file select-roles.blade.php Aux. Auxiliary script
  Accessible without login Plain text file user_table.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  stats  
File Role Description
Files folder imagelink (1 file)
  Accessible without login Plain text file content.blade.php Aux. Auxiliary script
  Accessible without login Plain text file content.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  tabs  
File Role Description
  Accessible without login Plain text file admin-links.blade.php Aux. Auxiliary script
  Accessible without login Plain text file home.blade.php Aux. Auxiliary script
  Accessible without login Plain text file settings.blade.php Aux. Auxiliary script
  Accessible without login Plain text file stats.blade.php Aux. Auxiliary script
  Accessible without login Plain text file user-links.blade.php Aux. Auxiliary script
  Accessible without login Plain text file users.blade.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageAjax (2 directories)
Files folder imageHelpers (1 file)
  Accessible without login Plain text file PolrAdmin.php Class Class source
  Accessible without login Plain text file start.php Example Example script

  Files folder image Files  /  src  /  Ajax  
File Role Description
Files folder imageClasses (3 files)
Files folder imagePlugins (1 directory)

  Files folder image Files  /  src  /  Ajax  /  Classes  
File Role Description
  Accessible without login Plain text file Link.php Class Class source
  Accessible without login Plain text file Stats.php Class Class source
  Accessible without login Plain text file User.php Class Class source

  Files folder image Files  /  src  /  Ajax  /  Plugins  
File Role Description
Files folder imageDatatables (3 files)

  Files folder image Files  /  src  /  Ajax  /  Plugins  /  Datatables  
File Role Description
  Accessible without login Plain text file Datatables.php Class Class source
  Accessible without login Plain text file Plugin.php Class Class source
  Accessible without login Plain text file Renderer.php Class Class source

  Files folder image Files  /  src  /  Helpers  
File Role Description
  Accessible without login Plain text file Validator.php Class Class source

Downloadpolr-admin-2017-12-10.zip 89KB
Downloadpolr-admin-2017-12-10.tar.gz 79KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Jaxon Download .zip .tar.gz Uses the provided features Required
Polr Restful API Download .zip .tar.gz Needs to be installed on managed Polr instances Required
 Version Control Unique User Downloads Download Rankings  
 100%
Total:78
This week:0
All time:8,973
This week:617Up