Skip to content

Commit

Permalink
Merge branch 'master' into issue217
Browse files Browse the repository at this point in the history
Conflicts:
	app/start/artisan.php
  • Loading branch information
coogle committed Jun 16, 2014
2 parents c06c709 + 99b8cc4 commit 5b28a2c
Show file tree
Hide file tree
Showing 34 changed files with 1,835 additions and 2,334 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = function (grunt) {
'public/bower_components/angular-cookies/angular-cookies.js',
'public/bower_components/angular-ui/build/angular-ui.min.js',
'public/bower_components/zeroclipboard/dist/ZeroClipboard.min.js',
'public/bower_components/angular-growl/build/angular-growl.min.js',
'node_modules/twitter-bootstrap-3.0.0/dist/js/bootstrap.min.js',

//Datetimepicker and dependencies
Expand Down
124 changes: 124 additions & 0 deletions app/commands/ActivityExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class ActivityExport extends Command {

/**
* The console command name.
*
* @var string
*/
protected $name = 'activity:export';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Export Annotations and Comments';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$doc_id = $this->argument('doc_id');
$filename = $this->argument('filename');

$doc = Doc::where('id', $doc_id)->first();
$this->info("Exporting activity for " . $doc->title);

$annotations = Annotation::where('doc_id', $this->argument('doc_id'))->with('user')->with('comments')->get();
$comments = Comment::where('doc_id', $this->argument('doc_id'))->with('user')->get();

$headers = array("Created At", "Link", "Display Name", "Full Name", "Email", "Type", "Quote", "Text");

$toExport = array();

foreach($annotations as $annotation){
$annotationArray = array();

$annotationArray['date'] = $annotation->created_at;
$annotationArray['link'] = URL::to('/') . $annotation->uri . '#annotation_' . $annotation->id;
$annotationArray['display_name'] = $annotation->user->fname . " " . substr($annotation->user->lname, 0, 1);
$annotationArray['full_name'] = $annotation->user->fname . " " . $annotation->user->lname;
$annotationArray['email'] = $annotation->user->email;
$annotationArray['type'] = 'Annotation';
$annotationArray['quote'] = $annotation->quote;
$annotationArray['text'] = $annotation->text;

array_push($toExport, $annotationArray);

foreach($annotation->comments as $comment){
$user = User::find($comment->user_id);

$commentArray = array();

$commentArray['date'] = $comment->created_at;
$commentArray['link'] = "";
$commentArray['display_name'] = $user->fname . " " . substr($user->lname, 0, 1);
$commentArray['full_name'] = $user->fname . " " . $user->lname;
$commentArray['email'] = $user->email;
$commentArray['type'] = "Annotation Comment";
$commentArray['quote'] = "";
$commentArray['text'] = $comment->text;

array_push($toExport, $commentArray);
}
}

foreach($comments as $comment){
$commentArray = array();

$commentArray['date'] = $comment->created_at;
$commentArray['link'] = "";
$commentArray['display_name'] = $comment->user->fname . " " . substr($comment->user->lname, 0, 1);
$commentArray['full_name'] = $comment->user->fname . " " . $comment->user->lname;
$commentArray['email'] = $comment->user->email;
$commentArray['type'] = $comment->parent_id === null ? "Comment" : "Sub-comment";
$commentArray['quote'] = "";
$commentArray['text'] = $comment->text;

array_push($toExport, $commentArray);
}

$this->info('Saving export to ' . $filename);
$fp = fopen($filename, 'w');
fputcsv($fp, $headers);

foreach($toExport as $row){
fputcsv($fp, $row);
}

fclose($fp);
$this->info('Done.');
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('doc_id', InputArgument::REQUIRED, 'Document id for exported activity.'),
array('filename', InputArgument::REQUIRED, 'Filename to save csv as.'),
);
}
}
3 changes: 2 additions & 1 deletion app/start/artisan.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

Artisan::add(new CreateUser);
Artisan::add(new UserRole);
Artisan::add(new SponsorCommand());
Artisan::add(new SponsorCommand());
Artisan::add(new ActivityExport);
60 changes: 2 additions & 58 deletions app/views/doc/reader/activity.blade.php
Original file line number Diff line number Diff line change
@@ -1,62 +1,6 @@
<h3>Activity</h3>
<div class="activity-thread col-md-12">
<div class="row activity-item" ng-repeat="activity in activities | orderBy:activityOrder:true track by $id(activity)" ng-class="activity.label">
<div class="row">
<div class="activity-author col-md-9">
<span>@{{ activity.user.name || (activity.user.fname + ' ' + activity.user.lname.substr(0,1)) }}</span>
</div>
<div class="activity-icon col-md-3">
<a href="#@{{ activity.link }}" ng-if="activity.label==='annotation'"><span class="glyphicon glyphicon-screenshot" title="Jump to annotation"></span></a>
<span class="glyphicon" ng-class="{'glyphicon-comment': activity.label=='comment', 'glyphicon-edit': activity.label=='annotation'}" title="@{{ activity.label }}"></span>
</div>
</div>
<div class="row">
<div class="activity-content col-md-12">
<span>@{{ activity.text }}</span>
</div>
</div>
<div class="row">
<div class="col-md-6">
<span class="activity-replies-indicator" ng-click="collapseComments(activity)"><span class="glyphicon glyphicon-share-alt"></span>@{{ activity.comments.length || '0' }} Replies</span>
</div>
<div class="col-md-6 activity-actions">
<span class="glyphicon glyphicon-thumbs-up" ng-click="addAction(activity, 'likes', $event)">(@{{ activity.likes || '0' }})</span>
<span class="glyphicon glyphicon-thumbs-down" ng-click="addAction(activity, 'dislikes', $event)">(@{{ activity.dislikes || '0' }})</span>
<span class="glyphicon glyphicon-flag" ng-click="addAction(activity, 'flags', $event)">(@{{ activity.flags || '0' }})</span>
</div>
</div>
<div class="activity-replies row" collapse="activity.commentsCollapsed">
<div class="activity-reply col-md-12" ng-repeat="comment in activity.comments">
<div class="reply-author row">
<div class="col-md-6">
<span class="glyphicon glyphicon-share-alt"></span> @{{ comment.user.name || (comment.user.fname + ' ' + comment.user.lname.substr(0,1)) }}:
</div>
</div>
<div class="reply-text row">
<div class="col-md-12">
@{{ comment.text }}
</div>
</div>
</div>
@if(Auth::check())
<div class="subcomment-field col-md-12">
<form name="add-subcomment-form" ng-submit="subcommentSubmit(activity, subcomment)">
<input ng-model="subcomment.text" type="text" class="form-control centered" placeholder="Add a comment" required />
</form>
</div>
@endif
</div>
<div class="row sponsor-seen" ng-show="user.isSponsor && activity.user.id != user.id">
<div class="col-md-12">
<span class="btn btn-default" ng-if="activity.seen === 0" ng-click="notifyAuthor(activity)">Mark as seen</span>
<span class="glyphicon glyphicon-ok" ng-if="activity.seen === 1"> Marked as seen!</span>
</div>
</div>
<div class="row user-seen" ng-hide="user.isSponsor">
<div class="col-md-12">
<span class="glyphicon glyphicon-ok" ng-if="activity.seen === 1"> A sponsor marked this as seen!</span>
</div>
</div>
</div>
<div id="@{{ activity.label == 'comment' ? 'comment_' + activity.id : '' }}" class="row activity-item" ng-repeat="activity in activities | orderBy:activityOrder:true track by $id(activity)" ng-class="activity.label">
<div activity-item activity-item-link="@{{ activity.link }}"></div>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/layouts/assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


<!-- Stylesheets -->
{{ HTML::style('bower_components/angular-growl/build/angular-growl.min.css') }}
{{ HTML::style('vendor/pagedown/assets/demo.css') }}
{{ HTML::style('vendor/datetimepicker/datetimepicker.css') }}
{{ HTML::style('vendor/jquery/jquery-ui-smoothness.css') }}
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
<!--[if lt IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/" target="_blank">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div growl></div>
<div id="wrap">
<div id="header-main" class="navbar navbar-fixed-top" role="navigation">
<div id="header-main" class="navbar" role="navigation">
<div class="container">
@include('layouts.header')
</div>
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "madison",
"dependencies": {
"jquery-zclip": "~1.1.4",
"zeroclipboard": "~2.0.1"
"zeroclipboard": "~2.0.1",
"angular-growl": "~0.4.0"
},
"devDependencies": {
"pagedown": "~1.1.0",
Expand Down
40 changes: 40 additions & 0 deletions public/bower_components/angular-growl/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"author": "Marco Rinck",
"name": "angular-growl",
"description": "growl like notifications for angularJS projects, using bootstrap alert classes",
"version": "0.4.0",
"homepage": "https://github.com/marcorinck/angular-growl",
"repository": {
"type": "git",
"url": "https://github.com/marcorinck/angular-growl"
},
"license": "MIT",
"main": "./build/angular-growl.js",
"ignore": [
"src",
"test",
".jshintrc",
"package.json",
"gruntfile.js",
"karma.conf.js",
"bower.json",
"demo",
".gitignore"
],
"dependencies": {
"angular": "1.2.1"
},
"devDependencies": {
"angular-mocks": "1.2.1"
},
"_release": "0.4.0",
"_resolution": {
"type": "version",
"tag": "v0.4.0",
"commit": "e0e8b2cda660f28c75eefa7c9703952368547cdd"
},
"_source": "git://github.com/marcorinck/angular-growl.git",
"_target": "~0.4.0",
"_originalSource": "angular-growl",
"_direct": true
}
21 changes: 21 additions & 0 deletions public/bower_components/angular-growl/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 Marco Rinck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 5b28a2c

Please sign in to comment.