Skip to content

Commit

Permalink
Item13033: compatibility processing zones
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Mar 8, 2016
1 parent 9ebd58e commit b2c5b31
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@ AngularPlugin_installer
AngularPlugin_installer.pl
pub/System/AngularPlugin/angular.js
pub/System/AngularPlugin/vendor/*/
pub/System/AngularPlugin/modules/loadingBar/loading-bar.js
pub/System/AngularPlugin/modules/ngAnimate/angular-animate.js
pub/System/AngularPlugin/modules/ngAria/angular-aria.js
pub/System/AngularPlugin/modules/ngCookies/angular-cookies.js
Expand Down
2 changes: 1 addition & 1 deletion bin/angular
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2011-2015 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2016 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
31 changes: 16 additions & 15 deletions data/System/AngularPlugin.txt
@@ -1,6 +1,6 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1416833083" format="1.1" version="1"}%
---+!! %TOPIC%
%SHORTDESCRIPTION%
%FORMFIELD{"Description"}%

%TOC%

Expand Down Expand Up @@ -34,19 +34,20 @@ cake. The best of all: it makes development fun!
else="<a href='%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?angular_mode=1'>Angular Mode On</a>"
}%

---++ Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Author(s): | Michael Daum|
| Copyright: | &copy; 2014-2015 Michael Daum http://michaeldaumconsulting.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
---++ Dependencies
%$DEPENDENCIES%

---++ Change History
| 08 Mar 2016: | second alpha release |
| 27 Feb 2015: | first alpha release |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2014-2016 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]]"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/%TOPIC%"}%
%META:FIELD{name="Support" title="Support" value="Foswiki:Support/%TOPIC%"}%
%META:FIELD{name="Version" title="Version" value="%$VERSION%"}%
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/AngularPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# AngularPlugin is Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
# AngularPlugin is Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -33,8 +33,8 @@ use Foswiki::Plugins ();
use Foswiki::Plugins::JQueryPlugin();
use Foswiki::Contrib::JsonRpcContrib ();

our $VERSION = '1.00_001';
our $RELEASE = '1.00_001';
our $VERSION = '1.00_002';
our $RELEASE = '08 Mar 2016';
our $SHORTDESCRIPTION = 'A framework assisting with creating single-page applications';
our $NO_PREFS_IN_TOPIC = 1;
our $service;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Animate.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Aria.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Fx.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Loader.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Localize.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Messages.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Mocks.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Scenario.pm
Expand Up @@ -30,7 +30,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
38 changes: 27 additions & 11 deletions lib/Foswiki/Plugins/AngularPlugin/Service.pm
Expand Up @@ -10,7 +10,6 @@ use Foswiki::Plugins::AngularPlugin ();
use Foswiki::Contrib::JsonRpcContrib::Error ();
use JSON ();
use Error qw( :try );
#use Data::Dump qw(dump);

sub new {
my $class = shift;
Expand Down Expand Up @@ -136,18 +135,10 @@ sub getZoneObject {

my $session = $Foswiki::Plugins::SESSION;

my @total;
my %visited;
my @zoneIDs = values %{$session->{_zones}{$zone}};

foreach my $zoneID (@zoneIDs) {
$session->_visitZoneID($zoneID, \%visited, \@total);
}

my @zone = ();
my $excludeFromZone = $Foswiki::cfg{AngularPlugin}{ExcludeFromZone};

foreach my $item (grep { $_->{text} } @total) {
foreach my $item (grep { $_->{text} } $this->getZoneItems($zone)) {
if ($excludeFromZone && $item->{id} =~ /$excludeFromZone/g) {
#print STDERR "excluding $item->{id}\n";
next;
Expand All @@ -168,6 +159,31 @@ sub getZoneObject {
return \@zone;
}

sub getZoneItems {
my ($this, $zone) = @_;

my $session = $Foswiki::Plugins::SESSION;
my $zonesHandler;

if ($session->can("zones")) {
# Foswiki > 2.0.3: zones are stored in a sub-component
$zonesHandler = $session->zones();
} else {
# Foswiki <= 2.0.3: zones are stored in the session object
$zonesHandler = $session;
}

my @zoneItems = values %{$zonesHandler->{_zones}{$zone}};
my %visited = ();
my @result = ();

foreach my $item (@zoneItems) {
$zonesHandler->_visitZoneID($item, \%visited, \@result);
}

return @result;
}

sub expandTemplate {
my ($this, $template, $meta) = @_;

Expand Down Expand Up @@ -213,7 +229,7 @@ sub json {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
5 changes: 4 additions & 1 deletion pub/System/AngularPlugin/Makefile
@@ -1,13 +1,16 @@
FOSWIKI_ROOT?=~/foswiki/core
SUBDIRS=modules i18n
SUBDIRS=modules
# i18n
#vendor
TARGET=angular.js

-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include

ifneq (,$(wildcard vendor))
angular.uncompressed.js: vendor/angular.js/build/angular.js
@echo getting $@ from git
@cp $< $@
endif

clean:
rm -f $(TARGET) *.gz
1 change: 0 additions & 1 deletion pub/System/AngularPlugin/modules/loadingBar/loading-bar.js

This file was deleted.

0 comments on commit b2c5b31

Please sign in to comment.