Top Level Namespace

Extended by:
Zena::Console

Defined Under Namespace

Modules: AclsHelper, ActionController, ApplicationHelper, Bricks, DocumentsHelper, NodesHelper, RelationsHelper, Syntax, UsersHelper, VersionsHelper, Zafu, Zena Classes: Acl, AclsController, ApplicationController, Attachment, Cache, CachedPage, Column, ColumnsController, Comment, CommentsController, DataEntriesController, DataEntry, DateTime, Dir, Discussion, DiscussionsController, Document, DocumentContent, DocumentsController, DynAttribute, ExifData, FileUtils, Fixnum, Float, Group, GroupsController, IdxNodesDatetime, IdxNodesFloat, IdxNodesInteger, IdxNodesMlString, IdxNodesString, IdxProject, IdxTemplate, Iformat, IformatsController, Image, ImageContent, Link, LinksController, LogRecorder, Node, NodesController, Note, Page, PingsController, Project, Relation, RelationProxy, RelationsController, Role, Section, Site, SitesController, Skin, String, StringHash, Template, TemplateContent, TemplateVersion, TextDocument, TextDocumentContent, User, UserSession, UserSessionsController, UsersController, Version, VersionsController, VirtualClass, VirtualClassesController, ZenaNodeResource, ZipClass

Constant Summary collapse

SITES_ROOT =

FIXME: ========== cleanup

"#{RAILS_ROOT}/sites"
AUTHENTICATED_PREFIX =
"oo"
PASSWORD_SALT =

type anything here (but change this line !)

"jf93jfnvnas09093nas0923"
ZENA_CALENDAR_LANGS =

FIXME: build this dynamically from existing files

["en", "fr", "de"]
ENABLE_XSENDFILE =
false
EXT_TYPE =

FIXME: use another mime types library… this list is taken from www.duke.edu/websrv/file-extensions.html

[
  [ "ai"        , "application/postscript"         ],
  [ "aif"       , "audio/x-aiff"                   ],
  [ "aifc"      , "audio/x-aiff"                   ],
  [ "aiff"      , "audio/x-aiff"                   ],
  [ "au"        , "audio/basic"                    ],
  [ "avi"       , "video/x-msvideo"                ],
  [ "bcpio"     , "application/x-bcpio"            ],
  [ "bin"       , "application/octet-stream"       ],
  [ "ccad"      , "application/clariscad"          ],
  [ "cdf"       , "application/x-netcdf"           ],
  [ "class"     , "application/octet-stream"       ],
  [ "cpio"      , "application/x-cpio"             ],
  [ "cpt"       , "application/mac-compactpro"     ],
  [ "csh"       , "application/x-csh"              ],
  [ "css"       , "text/css"                       ],
  [ "dcr"       , "application/x-director"         ],
  [ "dir"       , "application/x-director"         ],
  [ "dms"       , "application/octet-stream"       ],
  [ "doc"       , "application/msword"             ],
  [ "docx"      , "application/vnd.openxmlformats-officedocument.wordprocessingml.document"             ],
  [ "drw"       , "application/drafting"           ],
  [ "dvi"       , "application/x-dvi"              ],
  [ "dwg"       , "application/acad"               ],
  [ "dxf"       , "application/dxf"                ],
  [ "dxr"       , "application/x-director"         ],
  [ "eps"       , "application/postscript"         ],
  [ "etx"       , "text/x-setext"                  ],
  [ "exe"       , "application/octet-stream"       ],
  [ "ez"        , "application/andrew-inset"       ],
  [ "fli"       , "video/x-fli"                    ],
  [ "gif"       , "image/gif"                      ],
  [ "gtar"      , "application/x-gtar"             ],
  [ "gz"        , "application/x-gzip"             ],
  [ "hdf"       , "application/x-hdf"              ],
  [ "hqx"       , "application/mac-binhex40"       ],
  [ "html"      , "text/html"                      ],
  [ "htm"       , "text/html"                      ],
  [ "ice"       , "x-conference/x-cooltalk"        ],
  [ "ief"       , "image/ief"                      ],
  [ "iges"      , "model/iges"                     ],
  [ "igs"       , "model/iges"                     ],
  [ "ips"       , "application/x-ipscript"         ],
  [ "ipx"       , "application/x-ipix"             ],
  [ "jpg"       , "image/jpeg"                     ],
  [ "jpe"       , "image/jpeg"                     ],
  [ "jpeg"      , "image/jpeg"                     ],
  [ "js"        , "application/x-javascript"       ],
  [ "js"        , "text/javascript"                ],
  [ "kar"       , "audio/midi"                     ],
  [ "latex"     , "application/x-latex"            ],
  [ "lha"       , "application/octet-stream"       ],
  [ "lsp"       , "application/x-lisp"             ],
  [ "lzh"       , "application/octet-stream"       ],
  [ "man"       , "application/x-troff-man"        ],
  [ "me"        , "application/x-troff-me"         ],
  [ "mesh"      , "model/mesh"                     ],
  [ "mid"       , "audio/midi"                     ],
  [ "midi"      , "audio/midi"                     ],
  [ "mif"       , "application/vnd.mif"            ],
  [ "mime"      , "www/mime"                       ],
  [ "mov"       , "video/quicktime"                ],
  [ "movie"     , "video/x-sgi-movie"              ],
  [ "mp2"       , "audio/mpeg"                     ],
  [ "mp3"       , "audio/mpeg"                     ],
  [ "mp4"       , "video/mp4"                      ],
  [ "m4v"       , "video/mp4"                      ],
  [ "mpe"       , "video/mpeg"                     ],
  [ "mpeg"      , "video/mpeg"                     ],
  [ "mpg"       , "video/mpeg"                     ],
  [ "mpga"      , "audio/mpeg"                     ],
  [ "ms"        , "application/x-troff-ms"         ],
  [ "msh"       , "model/mesh"                     ],
  [ "nc"        , "application/x-netcdf"           ],
  [ "oda"       , "application/oda"                ],
  [ "pbm"       , "image/x-portable-bitmap"        ],
  [ "pdb"       , "chemical/x-pdb"                 ],
  [ "pdf"       , "application/pdf"                ],
  [ "pgm"       , "image/x-portable-graymap"       ],
  [ "pgn"       , "application/x-chess-pgn"        ],
  [ "png"       , "image/png"                      ],
  [ "pnm"       , "image/x-portable-anymap"        ],
  [ "pot"       , "application/mspowerpoint"       ],
  [ "ppm"       , "image/x-portable-pixmap"        ],
  [ "pps"       , "application/mspowerpoint"       ],
  [ "ppt"       , "application/mspowerpoint"       ],
  [ "pptx"      , "application/vnd.openxmlformats-officedocument.presentationml.presentation"       ],
  [ "ppz"       , "application/mspowerpoint"       ],
  [ "pre"       , "application/x-freelance"        ],
  [ "prt"       , "application/pro_eng"            ],
  [ "ps"        , "application/postscript"         ],
  [ "qt"        , "video/quicktime"                ],
  [ "ra"        , "audio/x-realaudio"              ],
  [ "ram"       , "audio/x-pn-realaudio"           ],
  [ "ras"       , "image/cmu-raster"               ],
  [ "rb"        , "text/x-ruby-script"             ],
  [ "rgb"       , "image/x-rgb"                    ],
  [ "rm"        , "audio/x-pn-realaudio"           ],
  [ "roff"      , "application/x-troff"            ],
  [ "rpm"       , "audio/x-pn-realaudio-plugin"    ],
  [ "rss"       , "application/rss+xml"            ],
  [ "rtf"       , "text/rtf"                       ],
  [ "rtx"       , "text/richtext"                  ],
  [ "scm"       , "application/x-lotusscreencam"   ],
  [ "set"       , "application/set"                ],
  [ "sgm"       , "text/sgml"                      ],
  [ "sgml"      , "text/sgml"                      ],
  [ "sh"        , "application/x-sh"               ],
  [ "shar"      , "application/x-shar"             ],
  [ "silo"      , "model/mesh"                     ],
  [ "sit"       , "application/x-stuffit"          ],
  [ "skd"       , "application/x-koan"             ],
  [ "skm"       , "application/x-koan"             ],
  [ "skp"       , "application/x-koan"             ],
  [ "skt"       , "application/x-koan"             ],
  [ "smi"       , "application/smil"               ],
  [ "smil"      , "application/smil"               ],
  [ "snd"       , "audio/basic"                    ],
  [ "sol"       , "application/solids"             ],
  [ "spl"       , "application/x-futuresplash"     ],
  [ "src"       , "application/x-wais-source"      ],
  [ "step"      , "application/STEP"               ],
  [ "stl"       , "application/SLA"                ],
  [ "stp"       , "application/STEP"               ],
  [ "sv4cpio"   , "application/x-sv4cpio"          ],
  [ "sv4crc"    , "application/x-sv4crc"           ],
  [ "swf"       , "application/x-shockwave-flash"  ],
  [ "t"         , "application/x-troff"            ],
  [ "tgz"       , "application/x-gzip"             ],
  [ "tar"       , "application/x-tar"              ],
  [ "tcl"       , "application/x-tcl"              ],
  [ "tex"       , "application/x-tex"              ],
  [ "texi"      , "application/x-texinfo"          ],
  [ "texinf"    , "application/x-texinfo"          ],
  [ "txt"       , "text/plain"                     ],
  [ "hh"        , "text/plain"                     ],
  [ "h"         , "text/plain"                     ],
  [ "hpp"       , "text/plain"                     ],
  [ "asc"       , "text/plain"                     ],
  [ "c"         , "text/plain"                     ],
  [ "m"         , "text/plain"                     ],
  [ "cc"        , "text/plain"                     ],
  [ "cpp"       , "text/plain"                     ],
  [ "f"         , "text/plain"                     ],
  [ "f90"       , "text/plain"                     ],
  [ "tiff"      , "image/tiff"                     ],
  [ "tr"        , "application/x-troff"            ],
  [ "tsi"       , "audio/TSP-audio"                ],
  [ "tsp"       , "application/dsptype"            ],
  [ "tsv"       , "text/tab-separated-values"      ],
  [ "unv"       , "application/i-deas"             ],
  [ "ustar"     , "application/x-ustar"            ],
  [ "vcd"       , "application/x-cdlink"           ],
  [ "vcf"       , "text/x-vCard"                   ],
  [ "vcard"     , "text/x-vCard"                   ],
  [ "vda"       , "application/vda"                ],
  [ "viv"       , "video/vnd.vivo"                 ],
  [ "vivo"      , "video/vnd.vivo"                 ],
  [ "vrml"      , "model/vrml"                     ],
  [ "wav"       , "audio/x-wav"                    ],
  [ "wrl"       , "model/vrml"                     ],
  [ "xbm"       , "image/x-xbitmap"                ],
  [ "xlc"       , "application/vnd.ms-excel"       ],
  [ "xll"       , "application/vnd.ms-excel"       ],
  [ "xlm"       , "application/vnd.ms-excel"       ],
  [ "xls"       , "application/vnd.ms-excel"       ],
  [ "xlsx"      , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"       ],
  [ "xlw"       , "application/vnd.ms-excel"       ],
  [ "xml"       , "text/xml"                       ],
  [ "xsl"       , "text/xml"                       ],
  [ "xslt"      , "text/xml"                       ],
  [ "xpm"       , "image/x-xpixmap"                ],
  [ "xwd"       , "image/x-xwindowdump"            ],
  [ "xyz"       , "chemical/x-pdb"                 ],
  [ "yml"       , "text/yaml"                      ],
  [ "zafu"      , "text/zafu"                      ],
  [ "zip"       , "application/zip"                ],
  [ "zml"       , "text/znode"                     ],
]
ZazenParser =

FIXME: use Zafu parser

Zena::Parser.parser_with_rules(Zena::Parser::ZazenRules, Zena::Parser::ZazenTags)
SERVER_PORT =
2999

Instance Method Summary collapse

Methods included from Zena::Console

change_prop, count, create, err, field_to_prop, find, foreach, included, login, nodes, profile, rename_prop, set_prop

Methods included from Zena::Acts::Secure

#secure_scope, #secure_write_scope, #visitor=

Methods included from Zena::Acts::Secure::SecureResult

#construct_id_map, #secure_result

Instance Method Details

#current_siteObject

Return the current site. Raise an error if the visitor is not set.



309
310
311
# File 'lib/zena/acts/secure.rb', line 309

def current_site
  visitor.site
end

#make_hashes(h) ⇒ Object



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/zena.rb', line 453

def make_hashes(h)
  val_to_keys = {}
  keys_to_val = {}
  h.each do |e|
    k,v = e
    if keys_to_val[k]
      keys_to_val[k] << v
    else
      keys_to_val[k] = [v]
    end

    if val_to_keys[v]
      val_to_keys[v] << k
    else
      val_to_keys[v] = [k]
    end
  end
  [keys_to_val, val_to_keys]
end

#setup_visitor(user, site) ⇒ Object

This method should be used to install a given user and site as the current visitor.



314
315
316
317
318
319
# File 'lib/zena/acts/secure.rb', line 314

def setup_visitor(user, site)
  raise "Missing site information" unless site
  Thread.current[:visitor] = user
  # Load alias site in visitor
  user.site = site
end

#visitorObject

Return the current visitor. Raise an error if the visitor is not set. For controllers, this method must be redefined in Application



323
324
325
# File 'lib/zena/acts/secure.rb', line 323

def visitor
  Thread.current[:visitor] || (raise Zena::RecordNotSecured.new("Visitor not set, record not secured."))
end