code
stringlengths
1
1.73M
language
stringclasses
1 value
=begin = File metadata.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public...
Ruby
=begin = File reference.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public...
Ruby
=begin = File parsers/fdf.rb = Info Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Origami is distributed in the...
Ruby
=begin = File parsers/pdf.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Pub...
Ruby
=begin = File parsers/ppklite.rb = Info Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Origami is distributed in...
Ruby
=begin = File parsers/linear.rb = Info Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Origami is distributed in ...
Ruby
=begin = File graphics/instruction.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Ge...
Ruby
=begin = File graphics/colors.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General...
Ruby
=begin = File graphics/state.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General ...
Ruby
=begin = File graphics/render.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General...
Ruby
=begin = File graphics/patterns.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Gener...
Ruby
=begin = File graphics/path.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General P...
Ruby
=begin = File graphics/xobject.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Genera...
Ruby
=begin = File graphics/text.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General P...
Ruby
=begin = File filters.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public ...
Ruby
=begin = File file.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Lic...
Ruby
=begin = File stream.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Li...
Ruby
=begin = File outputintents.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Pu...
Ruby
=begin = File numeric.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public L...
Ruby
=begin = File webcapture.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Publi...
Ruby
=begin = File encryption.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume DelugrÈ <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Publ...
Ruby
=begin = File formats/fdf.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General P...
Ruby
=begin = File formats/ppklite.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Gener...
Ruby
=begin = File origami.rb = Info Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Origami is distributed in the hop...
Ruby
# This is a comment ActiveRecord::Schema.define(:version => 20110520055633) do create_table "check_ins", :force => true do |t| t.boolean "hidden", :default => false t.integer "item_id" t.integer "location_id" t.datetime "created_at" t.datetime "updated_at" t.integer "user_...
Ruby
# This is a comment ActiveRecord::Schema.define(:version => 20110520055633) do create_table "check_ins", :force => true do |t| t.boolean "hidden", :default => false t.integer "item_id" t.integer "location_id" t.datetime "created_at" t.datetime "updated_at" t.integer "user_...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# Be sure to restart your server when you modify this file. # These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveReco...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying do debug a probl...
Ruby
# # deploy.rb # # author: Andrew Smith <andrewrs@cs.washington.edu> # modified: 6 May 2011 # # Deployment script and settings for Capistrano. This defines all the settings # needed to run cap deploy and launch the latest version of the web app. # set :application, "lab-system" set :repository, "https://lab-specimen-t...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.toggle_resolved_lost_items 'lost_items/toggle_resolved', :controller => 'lost_items', :action => 'toggle_resolved' map.resources :lost_items map.resources :stops map.checklist_recurrence_rules 'checklists/:id/edit', :controller => 'checklists', :actio...
Ruby
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy' # remove this line to skip loading any of the default tasks
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module ItemAttributeSetsHelper end
Ruby
module ChecklistItemInstancesHelper end
Ruby
module LocationsHelper end
Ruby
module UsersHelper end
Ruby
module LostItemsHelper end
Ruby
module RoutesHelper def add_stop_link(name, add_to_id, partial, obj) link_to_function name do |page| page.insert_html :bottom, add_to_id, :partial => partial, :object => obj end end end
Ruby
module ItemTypesHelper end
Ruby
module CouriersHelper end
Ruby
module HomeHelper end
Ruby
module RouteRecurrenceRulesHelper end
Ruby
module RouteInstancesHelper end
Ruby
module ChecklistRecurrenceRulesHelper end
Ruby
module CheckInsHelper end
Ruby
module ChecklistInstancesHelper end
Ruby
module ChecklistItemsHelper end
Ruby
module IdentifiersHelper end
Ruby
require 'barby/outputter/svg_outputter' module ItemsHelper def add_contained_item(name, container_div, prefix) link_to_function name, :class => 'add_item_to_container' do |page| page.insert_html :bottom, container_div, :partial => 'contained_item_form', :object => populate_new_item(true), :locals => {:prefi...
Ruby
module ChecklistsHelper def add_task_link(name, add_to_id, partial, obj) link_to_function name do |page| page.insert_html :bottom, add_to_id, :partial => partial, :object => obj end end end
Ruby
module CommentsHelper end
Ruby
module StopInstancesHelper end
Ruby
module ItemAttributesHelper end
Ruby
module StopsHelper end
Ruby
class ItemAttributeValue < ActiveRecord::Base belongs_to :item belongs_to :item_attribute end
Ruby
class Location < ActiveRecord::Base has_many :users has_many :check_ins has_many :incoming_items, :class_name => 'Item', :foreign_key => "destination_id" has_many :outgoing_items, :class_name => 'Item', :foreign_key => "source_id" has_many :stop_instances has_many :stops validates_presence_of :...
Ruby
class Checklist < ActiveRecord::Base ChecklistTypes = %w( before after ) has_many :checklist_instances has_many :checklist_items has_many :checklist_recurrence_rules validates_presence_of :name validates_inclusion_of :checklist_type, :in => ChecklistTypes, :message => 'must be "after" or "before"'...
Ruby
class StopInstance < ActiveRecord::Base belongs_to :location belongs_to :stop belongs_to :route_instance end
Ruby
class ChecklistInstance < ActiveRecord::Base belongs_to :checklist has_many :checklist_item_instances belongs_to :courier end
Ruby
class Stop < ActiveRecord::Base belongs_to :location belongs_to :route has_many :stop_instances validates_presence_of :location end
Ruby
class ChecklistItem < ActiveRecord::Base belongs_to :checklist has_many :checklist_item_instances validates_presence_of :task_text, :message => "task text cannot be blank" end
Ruby
class ItemAttribute < ActiveRecord::Base belongs_to :item_attribute_set has_many :item_attribute_values has_many :items, :through => :item_attribute_values validates_presence_of :display_text # validates_presence_of :item_attribute_set, :message => "Needs to belong to an attribute set" end
Ruby
class ItemType < ActiveRecord::Base has_many :items validates_uniqueness_of :item_type, :case_sensitive => false end
Ruby
class CheckIn < ActiveRecord::Base Actions = ["initial_checkin", "pick_up", "transfer", "drop_off"] belongs_to :item validates_presence_of :item belongs_to :location validates_presence_of :location belongs_to :user validates_presence_of :user validates_presence_of :action validates_inclusion_of :a...
Ruby
class ChecklistRecurrenceRule < ActiveRecord::Base belongs_to :checklist belongs_to :courier end
Ruby
require 'digest/sha1' class User < ActiveRecord::Base PermissionLevels = ['admin', 'supervisor', 'staff', 'client', 'courier'].freeze has_many :check_ins has_many :comments has_one :courier belongs_to :location validates_presence_of :location, :if => :validate_location? def validate_location? ...
Ruby
class Courier < ActiveRecord::Base belongs_to :user has_many :checklist_instances has_many :checklist_recurrence_rules has_many :route_instances has_many :route_recurrence_rules has_many :carrying, :class_name => 'Items', :foreign_key => 'carried_by' validate :has_user # Wrappers for f...
Ruby
class Comment < ActiveRecord::Base belongs_to :item belongs_to :user validates_presence_of :user validates_presence_of :text end
Ruby
class RouteInstance < ActiveRecord::Base belongs_to :courier belongs_to :instantiated_by, :class_name => 'User' belongs_to :route has_many :stop_instances, :dependent => :destroy accepts_nested_attributes_for :stop_instances after_update :save_stop_instances validates_associated :stop_instances...
Ruby
class Route < ActiveRecord::Base has_many :route_instances has_many :route_recurrence_rules has_many :stops validates_presence_of :name validate :has_stops def new_stop_attributes=(stop_attributes) stop_attributes.each { |attributes| stops.build(attributes) } end def couriers (...
Ruby
class RouteRecurrenceRule < ActiveRecord::Base Days = [:su,:m,:t,:w,:th,:f,:s] DayToI = Hash[Days.zip((0..6).to_a.map(&:to_s))] IToDay = DayToI.invert # ActiveRecord uses this def respond_to?(m, *args, &block) return true if DayToI.member? m or (DayToI.member? m.to_s[0...-1].to_sym and m.to_s.last == '='...
Ruby
class ChecklistItemInstance < ActiveRecord::Base belongs_to :checklist_instance belongs_to :checklist_item validates_presence_of :task_text end
Ruby
class ItemAttributeSet < ActiveRecord::Base has_many :item_attributes end
Ruby
class Item < ActiveRecord::Base has_many :check_ins, :dependent => :destroy belongs_to :client, :class_name => 'User' has_many :comments, :dependent => :destroy has_many :contained_items, :class_name => 'Item', :foreign_key => 'contained_by_id' belongs_to :contained_by, :class_name => 'Item' belongs_to :so...
Ruby
class Identifier < ActiveRecord::Base belongs_to :item validates_uniqueness_of :identifier_value, :case_sensitive => false, :scope => :identifier_type # validate :identifier_value_format # Stub for identifier_value format # Change once we've established the barcode format we're using def identifi...
Ruby
class LostItem < ActiveRecord::Base belongs_to :item validates_uniqueness_of :item_id end
Ruby
class ErrorsController < ApplicationController # GET /errors/permissions # GET /errors/permissions.json def permissions @title = "Invalid Permissions" end end
Ruby
class HelpController < ApplicationController # GET /help def help_index @title = "Help Documentation" render 'index' end # GET /help/items def help_items @title = "Items - Help" render 'items' end # GET /help/couriers def help_couriers @title = "Couriers - Help" render 'couriers' end # GET ...
Ruby
class HomeController < ApplicationController # authenticates users and redirects to /items def login @logged_in_user = User.find_by_id(session[:user_id]) if @logged_in_user # already logged in respond_to do |format| if @logged_in_user.permission_level == 'courier' format.html { redirect_to ed...
Ruby
class CouriersController < ApplicationController before_filter :except => [:current_stops, :active_checklist, :update] do |controller| controller.authorize_permissions({:blocked_permissions => (User::PermissionLevels - ["admin"])}) end # GET /couriers # GET /couriers.json def index @title = "View Cou...
Ruby
class LostItemsController < ApplicationController # GET /lost_items # GET /lost_items.json def index @user = User.find_by_id(session[:user_id]) session[:show_resolved_lost_items] ||= false @show_resolved = session[:show_resolved_lost_items] if @show_resolved @lost_items = LostItem.fin...
Ruby
class ItemAttributesController < ApplicationController # GET /item_attributes # GET /item_attributes.json def index @item_attributes = ItemAttribute.all respond_to do |format| format.html # index.html.erb format.json { render :json => @item_attributes } end end # GET /item_attribute...
Ruby
class LocationsController < ApplicationController before_filter :except => [:show, :outgoing] do |controller| controller.authorize_permissions({:blocked_permissions => (User::PermissionLevels - ["admin"])}) end # GET /locations # GET /locations.json def index @title = "View Locations" session...
Ruby
class StopInstancesController < ApplicationController def set_visited @stop_instance = StopInstance.find(params["id"]) @stop_instance.visited = true @stop_instance.save respond_to do |format| format.json { render :json => [@stop_instance] } end end # GET /stop_instances # GET /sto...
Ruby
class RoutesController < ApplicationController before_filter do |controller| controller.authorize_permissions({:blocked_permissions => (User::PermissionLevels - ["admin"])}) end # GET /routes # GET /routes.json def index @title = "View Routes" session[:show_hidden_routes] ||= false @show_hidde...
Ruby
class StaticController < ApplicationController end
Ruby
class IdentifiersController < ApplicationController def by_barcode @identifier = [Identifier.find_by_identifier_value(params["id"]).item] respond_to do |format| format.json { render :json => @identifier } end end # GET /identifiers/1 # GET /identifiers/1.json def show @ident...
Ruby
class ItemAttributeSetsController < ApplicationController # GET /item_attribute_sets # GET /item_attribute_sets.json def index @item_attribute_sets = ItemAttributeSet.all respond_to do |format| format.html # index.html.erb format.json { render :json => @item_attribute_sets } end end ...
Ruby
class ChecklistsController < ApplicationController before_filter :except => [:get_before, :get_after] do |controller| controller.authorize_permissions({:blocked_permissions => (User::PermissionLevels - ["admin"])}) end def get_before @rules = @current_user.courier.checklist_recurrence_rules if @rules...
Ruby
class CommentsController < ApplicationController end
Ruby
class RouteInstancesController < ApplicationController # GET /route_instances # GET /route_instances.json def index @route_instances = RouteInstance.all respond_to do |format| format.html # index.html.erb format.json { render :json => @route_instances } end end # GET /route_instance...
Ruby
class CheckInsController < ApplicationController before_filter :except => [:index, :create] do |controller| controller.authorize_permissions({:blocked_permissions => ["courier"]}) end # GET /check_ins # GET /check_ins.json def index @noItem = "Checkin Items" @yesItemPrefix = "Checkin " if par...
Ruby