MANIFEST.in
by John (J5) Palmieri
MANIFEST.in | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 63409e0ab19a97d9d05241e312a55d99708cf121
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Jun 2 15:37:57 2009 -0400
add a manafest template
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..36eabf6
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,10 @@
+include docs/
+include production/
+include moksha.spec
+include stop-moksha
+include start-moksha
+include orbited.cfg
+include LICENSE
+include README
+include AUTHORS
+include COPYING
15 years
2 commits - apache/moksha.conf apache/moksha.wsgi moksha.spec nginx/moksha.conf production/apache rabbitmq/rabbitmq-codegen-amqp-codegen.patch rabbitmq/run sample-production.ini
by John (J5) Palmieri
apache/moksha.conf | 35 -----
apache/moksha.wsgi | 9 -
moksha.spec | 1
nginx/moksha.conf | 36 -----
production/apache/moksha.conf | 35 +++++
production/apache/moksha.wsgi | 9 +
rabbitmq/rabbitmq-codegen-amqp-codegen.patch | 16 --
rabbitmq/run | 22 ---
sample-production.ini | 176 ---------------------------
9 files changed, 45 insertions(+), 294 deletions(-)
New commits:
commit 85221b1337901fdc6a5e36ac9331396b8c7f88c8
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Jun 2 15:32:52 2009 -0400
remove duplicates and move apache dir to production dir
diff --git a/apache/moksha.conf b/apache/moksha.conf
deleted file mode 100644
index 59aceb8..0000000
--- a/apache/moksha.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-#MaxRequestsPerChild 100
-#HostnameLookups Off
-#Keepalive off
-
-# Default Python Home, with clean site-packages:
-WSGIPythonHome /srv/moksha/tg2env
-
-WSGIRestrictStdout Off
-
-WSGIPythonEggs /srv/moksha/.python-eggs
-
-<VirtualHost 0.0.0.0:8084>
-
- SSLEngine off
- DocumentRoot /srv/moksha
- ServerName Moksha
- ErrorLog logs/moksha_error_log
- CustomLog logs/moksha_access_log combined
-
- Alias /toscawidgets/ /srv/moksha/toscawidgets/
- <Directory /srv/moksha/toscawidgets/>
- Options -FollowSymLinks
- AllowOverride None
- Order allow,deny
- Allow from all
- </Directory>
-
- WSGIScriptAlias / /srv/moksha/apache/moksha.wsgi
-
- <Directory /srv/moksha/apache>
- Order deny,allow
- Allow from all
- </Directory>
-
-</VirtualHost>
diff --git a/apache/moksha.wsgi b/apache/moksha.wsgi
deleted file mode 100644
index 5f2dc95..0000000
--- a/apache/moksha.wsgi
+++ /dev/null
@@ -1,9 +0,0 @@
-import os, sys
-sys.path.append('/srv/moksha')
-os.environ['PYTHON_EGG_CACHE'] = '/srv/moksha/.python-eggs'
-
-#sys.stdout = sys.stderr
-
-from paste.deploy import loadapp
-
-application = loadapp('config:/srv/moksha/production.ini')
diff --git a/nginx/moksha.conf b/nginx/moksha.conf
deleted file mode 100644
index dad866a..0000000
--- a/nginx/moksha.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-upstream backend {
- server 127.0.0.1:8084;
-}
-
-server {
- listen 80;
- location / {
- #ssi on;
- proxy_set_header X_FORWARDED_PROTO $scheme;
- proxy_set_header X_FORWARDED_HOST $host;
- proxy_set_header X_FORWARDED_FOR $remote_addr;
-
- if ($request_method != GET) {
- proxy_pass http://backend;
- }
-
- set $memcached_key $request_uri;
-
- memcached_pass localhost:11211;
-
- default_type text/html;
- error_page 404 502 = /dynamic;
- }
-
- location /dynamic {
- #ssi on;
- proxy_set_header X_FORWARDED_PROTO $scheme;
- proxy_set_header X_FORWARDED_HOST $host;
- proxy_set_header X_FORWARDED_FOR $remote_addr;
- proxy_pass http://backend;
- }
-
-}
-
-
-
diff --git a/production/apache/moksha.conf b/production/apache/moksha.conf
new file mode 100644
index 0000000..59aceb8
--- /dev/null
+++ b/production/apache/moksha.conf
@@ -0,0 +1,35 @@
+#MaxRequestsPerChild 100
+#HostnameLookups Off
+#Keepalive off
+
+# Default Python Home, with clean site-packages:
+WSGIPythonHome /srv/moksha/tg2env
+
+WSGIRestrictStdout Off
+
+WSGIPythonEggs /srv/moksha/.python-eggs
+
+<VirtualHost 0.0.0.0:8084>
+
+ SSLEngine off
+ DocumentRoot /srv/moksha
+ ServerName Moksha
+ ErrorLog logs/moksha_error_log
+ CustomLog logs/moksha_access_log combined
+
+ Alias /toscawidgets/ /srv/moksha/toscawidgets/
+ <Directory /srv/moksha/toscawidgets/>
+ Options -FollowSymLinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ WSGIScriptAlias / /srv/moksha/apache/moksha.wsgi
+
+ <Directory /srv/moksha/apache>
+ Order deny,allow
+ Allow from all
+ </Directory>
+
+</VirtualHost>
diff --git a/production/apache/moksha.wsgi b/production/apache/moksha.wsgi
new file mode 100644
index 0000000..5f2dc95
--- /dev/null
+++ b/production/apache/moksha.wsgi
@@ -0,0 +1,9 @@
+import os, sys
+sys.path.append('/srv/moksha')
+os.environ['PYTHON_EGG_CACHE'] = '/srv/moksha/.python-eggs'
+
+#sys.stdout = sys.stderr
+
+from paste.deploy import loadapp
+
+application = loadapp('config:/srv/moksha/production.ini')
diff --git a/rabbitmq/rabbitmq-codegen-amqp-codegen.patch b/rabbitmq/rabbitmq-codegen-amqp-codegen.patch
deleted file mode 100644
index 91e3285..0000000
--- a/rabbitmq/rabbitmq-codegen-amqp-codegen.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- rabbitmq-codegen/amqp_codegen.py.orig 2009-03-06 19:33:25.000000000 -0500
-+++ rabbitmq-codegen/amqp_codegen.py 2009-03-06 19:33:39.000000000 -0500
-@@ -183,10 +183,11 @@
- fn(amqp_spec)
- except:
- remove(out_file)
-- raise
-- finally:
- sys.stdout = stdout
- f.close()
-+ raise
-+ sys.stdout = stdout
-+ f.close()
-
- if not len(sys.argv) == 4:
- usage()
diff --git a/rabbitmq/run b/rabbitmq/run
deleted file mode 100755
index a2d975c..0000000
--- a/rabbitmq/run
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-if [ ! -d rabbitmq-server ]; then
- hg clone http://hg.rabbitmq.com/rabbitmq-server
-fi
-if [ ! -d rabbitmq-codegen ]; then
- hg clone http://hg.rabbitmq.com/rabbitmq-codegen
- patch -p0 < rabbitmq-codegen-amqp-codegen.patch
-fi
-if [ ! -d rabbitmq-stomp ]; then
- hg clone http://hg.rabbitmq.com/rabbitmq-stomp
-fi
-
-pushd /usr/lib*/erlang/erts-*/bin >/dev/null
-export PATH=$PATH:`pwd`
-popd >/dev/null
-
-(cd rabbitmq-server; make)
-pushd rabbitmq-stomp >/dev/null
-make
-su -c 'make start_server'
-popd >/dev/null
diff --git a/sample-production.ini b/sample-production.ini
deleted file mode 100644
index b287a2d..0000000
--- a/sample-production.ini
+++ /dev/null
@@ -1,176 +0,0 @@
-#
-# moksha - Pylons development environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-# This file is for deployment specific config options -- other configuration
-# that is always required for the app is done in the config directory,
-# and generally should not be modified by end users.
-
-[DEFAULT]
-debug = false
-# Uncomment and replace with the address which should receive any error reports
-#email_to = you(a)yourdomain.com
-smtp_server = localhost
-error_email_from = paste@localhost
-
-##
-## Moksha-specific configuration options
-##
-
-# Where to store the feed caches.
-feed_cache = postgres://moksha:m0ksh4@localhost/moksha_feeds
-
-#
-# Feed Streamer settings
-#
-
-# Max age (in seconds) of each feed in the cache
-feed.max_age = 900
-
-# Timeout in seconds for the web request
-feed.timeout = 30
-
-# The number of simultaneous connections
-feed.deferred_groups = 10
-
-# Where to initialize and store our application databases. %s is the app name.
-app_db = sqlite:///%s.db
-
-# The location of our Orbited server
-orbited_host = localhost
-orbited_port = 9000
-
-# Stomp broker configuration.
-stomp_broker = localhost
-stomp_port = 61613
-stomp_user = guest
-stomp_pass = guest
-
-# Optional AMQP Broker.
-#amqp_broker = guest/guest@localhost
-
-# Documentation directory
-docs_dir = /srv/moksha/docs
-
-# Moksha chat configuration
-
-# Use a built-in IRC server
-#chat.backend = irc://localhost:9999
-#chat.builtin = true
-chat.backend = irc://irc.freenode.net:6667
-chat.rooms = default
-chat.default.staticRoomName = moksha
-chat.default.roomAssignmentMode = static
-chat.default.display.greeting = Moksha Chat
-#chat.default.display.floating = true
-#chat.default.display.floatingToggle = false
-#chat.default.display.width = 400
-#chat.default.display.height = 300
-#chat.default.display.theme = simple
-#chat.default.display.resizable = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 8080
-
-[app:main]
-use = egg:moksha
-full_stack = true
-#lang = ru
-cache_dir = %(here)s/data
-beaker.session.key = moksha
-beaker.session.secret = somesecret
-
-beaker.cache.type = ext:memcached
-beaker.cache.url = localhost:11211
-
-# If you'd like to fine-tune the individual locations of the cache data dirs
-# for the Cache data, or the Session saves, un-comment the desired settings
-# here:
-#beaker.cache.data_dir = %(here)s/data/cache
-#beaker.session.data_dir = %(here)s/data/sessions
-
-
-
-# pick the form for your database
-# %(here) may include a ':' character on Windows environments; this can
-# invalidate the URI when specifying a SQLite db via path name
-sqlalchemy.url=postgres://moksha:m0ksh4@localhost/moksha
-# sqlalchemy.url=mysql://username:password@hostname:port/databasename
-
-
-# If you have sqlite, here's a simple default to get you started
-# in development
-
-#sqlalchemy.url = sqlite:///%(here)s/devdata.db
-sqlalchemy.echo = true
-sqlalchemy.echo_pool = false
-sqlalchemy.pool_recycle = 3600
-
-# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-# Debug mode will enable the interactive debugging tool, allowing ANYONE to
-# execute malicious code after an exception is raised.
-#set debug = false
-
-# Logging configuration
-# Add additional loggers, handlers, formatters here
-# Uses python's logging config file format
-# http://docs.python.org/lib/logging-config-fileformat.html
-
-[loggers]
-keys = root, moksha, sqlalchemy, tg, auth, pylons
-
-[handlers]
-keys = console
-
-[formatters]
-keys = generic
-
-# If you create additional loggers, add them as a key to [loggers]
-[logger_root]
-level = INFO
-handlers = console
-
-[logger_moksha]
-level = DEBUG
-handlers =
-qualname = moksha
-
-[logger_tg]
-level = INFO
-handlers =
-qualname = tg
-
-# repoze.who is noisy by default
-[logger_auth]
-level = WARNING
-handlers =
-qualname = auth
-
-
-[logger_pylons]
-level = INFO
-handlers =
-qualname = pylons
-
-[logger_sqlalchemy]
-level = INFO
-handlers =
-qualname = sqlalchemy.engine
-# "level = INFO" logs SQL queries.
-# "level = DEBUG" logs SQL queries and results.
-# "level = WARN" logs neither. (Recommended for production systems.)
-
-# If you create additional handlers, add them as a key to [handlers]
-[handler_console]
-class = StreamHandler
-args = (sys.stderr,)
-level = NOTSET
-formatter = generic
-
-# If you create additional formatters, add them as a key to [formatters]
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S
commit ae7e9f9a9af1d559556cf8340eb40a985644b44a
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Jun 2 15:29:47 2009 -0400
add a requires
diff --git a/moksha.spec b/moksha.spec
index e73a9ed..9207bc6 100644
--- a/moksha.spec
+++ b/moksha.spec
@@ -36,6 +36,7 @@ Requires: python-tw-forms
Requires: python-morbid
Requires: pytz
Requires: pyevent
+Requires: python-repoze-who-testutil
%description
Moksha is a platform for creating real-time collaborative web applications. It
15 years
normal-reqs.txt
by John (J5) Palmieri
normal-reqs.txt | 2 --
1 file changed, 2 deletions(-)
New commits:
commit 6f1079dcedb741df27458123d1e8c97638980b8c
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Jun 2 14:16:54 2009 -0400
remove repoze.profile and repoze.squeeze as hard requirements
diff --git a/normal-reqs.txt b/normal-reqs.txt
index 224f063..1d740e5 100644
--- a/normal-reqs.txt
+++ b/normal-reqs.txt
@@ -47,8 +47,6 @@ orbited
#psycopg2
PyOpenSSL
pyprof2calltree
-repoze.profile
-repoze.squeeze
repoze.tm2
repoze.what
repoze.what-pylons
15 years
moksha.spec setup.py
by John (J5) Palmieri
moksha.spec | 30 +++++++++++++++---------------
setup.py | 4 ++--
2 files changed, 17 insertions(+), 17 deletions(-)
New commits:
commit 57408075a0c17d93bdbe8905fd22aa942703b074
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue Jun 2 13:43:45 2009 -0400
fix requires
diff --git a/moksha.spec b/moksha.spec
index 0ac322c..e73a9ed 100644
--- a/moksha.spec
+++ b/moksha.spec
@@ -19,22 +19,22 @@ BuildRequires: python-devel
BuildRequires: python-pygments
Requires: TurboGears2
-Requires: ToscaWidgets >= 0.9.1,
-Requires: zope.sqlalchemy,
-Requires: Shove,
-Requires: feedcache,
-Requires: feedparser,
-Requires: tw.jquery>=0.9.4.1,
-Requires: repoze.squeeze,
-Requires: repoze.profile,
-Requires: orbited,
-Requires: twisted,
-Requires: python-stomper,
-Requires: Sphinx,
-Requires: Paver,
-Requires: tw.forms,
+Requires: python-toscawidgets >= 0.9.1
+Requires: python-zope-sqlalchemy
+Requires: python-shove
+Requires: python-feedcache
+Requires: python-feedparser
+Requires: python-tw-jquery >= 0.9.4.1
+#Requires: python-repoze-squeeze
+#Requires: python-repoze-profile
+Requires: orbited
+Requires: python-twisted
+Requires: python-stomper
+Requires: python-sphinx
+Requires: python-paver
+Requires: python-tw-forms
Requires: python-morbid
-Requires: ptz
+Requires: pytz
Requires: pyevent
%description
diff --git a/setup.py b/setup.py
index 4e88958..fda64f4 100644
--- a/setup.py
+++ b/setup.py
@@ -31,8 +31,8 @@ setup(
"feedcache",
"feedparser",
"tw.jquery>=0.9.4.1",
- "repoze.squeeze",
- "repoze.profile",
+ #"repoze.squeeze", # Not hard requirements
+ #"repoze.profile", # Not hard requirements
"orbited",
"twisted",
"stomper",
15 years
2 commits - moksha/api moksha/public moksha/widgets
by Luke Macken
moksha/api/widgets/global_resources/widget.py | 2
moksha/public/javascript/jquery.expander.js | 152 ----------------------
moksha/widgets/expander.py | 26 ---
moksha/widgets/expander/__init__.py | 1
moksha/widgets/expander/expander.py | 28 ++++
moksha/widgets/expander/static/jquery.expander.js | 152 ++++++++++++++++++++++
6 files changed, 182 insertions(+), 179 deletions(-)
New commits:
commit afcc18a734343c7e891e93cba333902bc5caf8c8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sun May 31 19:14:00 2009 -0400
Fix a typo in a docstring
diff --git a/moksha/api/widgets/global_resources/widget.py b/moksha/api/widgets/global_resources/widget.py
index f9f1b46..5faef64 100644
--- a/moksha/api/widgets/global_resources/widget.py
+++ b/moksha/api/widgets/global_resources/widget.py
@@ -39,7 +39,7 @@ class GlobalResourceInjectionWidget(Widget):
:Note: Global Widget injection will only work when the global_resource
widget is actually rendered in the template. Otherwise, only JS
- and CSS resources fill get injected. Moksha's index.mak template
+ and CSS resources will get injected. Moksha's index.mak template
handles this for us, otherwise you can import the `global_resources`
widget from this module and do it yourself.
"""
diff --git a/moksha/widgets/expander.py b/moksha/widgets/expander.py
deleted file mode 100644
index b283216..0000000
--- a/moksha/widgets/expander.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# This file is part of Moksha
-# Copyright (C) 2008-2009 Red Hat, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-"""
-:mod:`fedoracommunity.widgets.expander` -- An Expander Widget
-=============================================================
-
-http://plugins.learningjquery.com/expander
-"""
-
-from tw.api import JSLink
-
-expander_js = JSLink(link='/javascript/jquery.expander.js')
commit 1dfdb07aff31da0073a0dc57655baff61906a348
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sun May 31 19:13:23 2009 -0400
Improve the expander plugin, have it require jquery, and move it's static resource
diff --git a/moksha/public/javascript/jquery.expander.js b/moksha/public/javascript/jquery.expander.js
deleted file mode 100644
index f56eef0..0000000
--- a/moksha/public/javascript/jquery.expander.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * jQuery Expander plugin
- * Version 0.4 (12/09/2008)
- * @requires jQuery v1.1.1+
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- */
-
-
-(function($) {
-
- $.fn.expander = function(options) {
-
- var opts = $.extend({}, $.fn.expander.defaults, options);
- var delayedCollapse;
- return this.each(function() {
- var $this = $(this);
- var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
- var cleanedTag, startTags, endTags;
- var allText = $this.html();
- var startText = allText.slice(0, o.slicePoint).replace(/\w+$/,'');
- startTags = startText.match(/<\w[^>]*>/g);
- if (startTags) {startText = allText.slice(0,o.slicePoint + startTags.join('').length).replace(/\w+$/,'');}
-
- if (startText.lastIndexOf('<') > startText.lastIndexOf('>') ) {
- startText = startText.slice(0,startText.lastIndexOf('<'));
- }
- var endText = allText.slice(startText.length);
- // create necessary expand/collapse elements if they don't already exist
- if (!$('span.details', this).length) {
- // end script if text length isn't long enough.
- if ( endText.replace(/\s+$/,'').split(' ').length < o.widow ) { return; }
- // otherwise, continue...
- if (endText.indexOf('</') > -1) {
- endTags = endText.match(/<(\/)?[^>]*>/g);
- for (var i=0; i < endTags.length; i++) {
-
- if (endTags[i].indexOf('</') > -1) {
- var startTag, startTagExists = false;
- for (var j=0; j < i; j++) {
- startTag = endTags[j].slice(0, endTags[j].indexOf(' ')).replace(/(\w)$/,'$1>');
- if (startTag == rSlash(endTags[i])) {
- startTagExists = true;
- }
- }
- if (!startTagExists) {
- startText = startText + endTags[i];
- var matched = false;
- for (var s=startTags.length - 1; s >= 0; s--) {
- if (startTags[s].slice(0, startTags[s].indexOf(' ')).replace(/(\w)$/,'$1>') == rSlash(endTags[i])
- && matched == false) {
- cleanedTag = cleanedTag ? startTags[s] + cleanedTag : startTags[s];
- matched = true;
- }
- };
- }
- }
- }
-
- endText = cleanedTag && cleanedTag + endText || endText;
- }
- $this.html([
- startText,
- '<span class="read-more">',
- o.expandPrefix,
- '<a href="#">',
- o.expandText,
- '</a>',
- '</span>',
- '<span class="details">',
- endText,
- '</span>'
- ].join('')
- );
- }
- var $thisDetails = $('span.details', this),
- $readMore = $('span.read-more', this);
- $thisDetails.hide();
- $readMore.find('a').click(function() {
- $readMore.hide();
-
- if (o.expandEffect === 'show' && !o.expandSpeed) {
- o.beforeExpand($this);
- $thisDetails.show();
- o.afterExpand($this);
- delayCollapse(o, $thisDetails);
- } else {
- o.beforeExpand($this);
- $thisDetails[o.expandEffect](o.expandSpeed, function() {
- $thisDetails.css({zoom: ''});
- o.afterExpand($this);
- delayCollapse(o, $thisDetails);
- });
- }
- return false;
- });
- if (o.userCollapse) {
- $this
- .find('span.details').append('<span class="re-collapse">' + o.userCollapsePrefix + '<a href="#">' + o.userCollapseText + '</a></span>');
- $this.find('span.re-collapse a').click(function() {
-
- clearTimeout(delayedCollapse);
- var $detailsCollapsed = $(this).parents('span.details');
- reCollapse($detailsCollapsed);
- o.onCollapse($this, true);
- return false;
- });
- }
- });
- function reCollapse(el) {
- el.hide()
- .prev('span.read-more').show();
- }
- function delayCollapse(option, $collapseEl) {
- if (option.collapseTimer) {
- delayedCollapse = setTimeout(function() {
- reCollapse($collapseEl);
- option.onCollapse($collapseEl.parent(), false);
- },
- option.collapseTimer
- );
- }
- }
- function rSlash(rString) {
- return rString.replace(/\//,'');
- }
- };
- // plugin defaults
- $.fn.expander.defaults = {
- slicePoint: 100, // the number of characters at which the contents will be sliced into two parts.
- // Note: any tag names in the HTML that appear inside the sliced element before
- // the slicePoint will be counted along with the text characters.
- widow: 4, // a threshold of sorts for whether to initially hide/collapse part of the element's contents.
- // If after slicing the contents in two there are fewer words in the second part than
- // the value set by widow, we won't bother hiding/collapsing anything.
- expandText: 'read more', // text displayed in a link instead of the hidden part of the element.
- // clicking this will expand/show the hidden/collapsed text
- expandPrefix: '… ',
- collapseTimer: 0, // number of milliseconds after text has been expanded at which to collapse the text again
- expandEffect: 'fadeIn',
- expandSpeed: '', // speed in milliseconds of the animation effect for expanding the text
- userCollapse: true, // allow the user to re-collapse the expanded text.
- userCollapseText: '[collapse expanded text]', // text to use for the link to re-collapse the text
- userCollapsePrefix: ' ',
- beforeExpand: function($thisEl) {},
- afterExpand: function($thisEl) {},
- onCollapse: function($thisEl, byUser) {}
- };
-})(jQuery);
diff --git a/moksha/widgets/expander/__init__.py b/moksha/widgets/expander/__init__.py
new file mode 100644
index 0000000..9bccce2
--- /dev/null
+++ b/moksha/widgets/expander/__init__.py
@@ -0,0 +1 @@
+from expander import expander_js
diff --git a/moksha/widgets/expander/expander.py b/moksha/widgets/expander/expander.py
new file mode 100644
index 0000000..78b9536
--- /dev/null
+++ b/moksha/widgets/expander/expander.py
@@ -0,0 +1,28 @@
+# This file is part of Moksha
+# Copyright (C) 2008-2009 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+:mod:`fedoracommunity.widgets.expander` -- An Expander Widget
+=============================================================
+
+http://plugins.learningjquery.com/expander
+"""
+
+from tw.api import JSLink
+from tw.jquery import jquery_js
+
+expander_js = JSLink(filename='static/jquery.expander.js',
+ modname=__name__, javascript=[jquery_js])
diff --git a/moksha/widgets/expander/static/jquery.expander.js b/moksha/widgets/expander/static/jquery.expander.js
new file mode 100644
index 0000000..f56eef0
--- /dev/null
+++ b/moksha/widgets/expander/static/jquery.expander.js
@@ -0,0 +1,152 @@
+/*
+ * jQuery Expander plugin
+ * Version 0.4 (12/09/2008)
+ * @requires jQuery v1.1.1+
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+
+(function($) {
+
+ $.fn.expander = function(options) {
+
+ var opts = $.extend({}, $.fn.expander.defaults, options);
+ var delayedCollapse;
+ return this.each(function() {
+ var $this = $(this);
+ var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
+ var cleanedTag, startTags, endTags;
+ var allText = $this.html();
+ var startText = allText.slice(0, o.slicePoint).replace(/\w+$/,'');
+ startTags = startText.match(/<\w[^>]*>/g);
+ if (startTags) {startText = allText.slice(0,o.slicePoint + startTags.join('').length).replace(/\w+$/,'');}
+
+ if (startText.lastIndexOf('<') > startText.lastIndexOf('>') ) {
+ startText = startText.slice(0,startText.lastIndexOf('<'));
+ }
+ var endText = allText.slice(startText.length);
+ // create necessary expand/collapse elements if they don't already exist
+ if (!$('span.details', this).length) {
+ // end script if text length isn't long enough.
+ if ( endText.replace(/\s+$/,'').split(' ').length < o.widow ) { return; }
+ // otherwise, continue...
+ if (endText.indexOf('</') > -1) {
+ endTags = endText.match(/<(\/)?[^>]*>/g);
+ for (var i=0; i < endTags.length; i++) {
+
+ if (endTags[i].indexOf('</') > -1) {
+ var startTag, startTagExists = false;
+ for (var j=0; j < i; j++) {
+ startTag = endTags[j].slice(0, endTags[j].indexOf(' ')).replace(/(\w)$/,'$1>');
+ if (startTag == rSlash(endTags[i])) {
+ startTagExists = true;
+ }
+ }
+ if (!startTagExists) {
+ startText = startText + endTags[i];
+ var matched = false;
+ for (var s=startTags.length - 1; s >= 0; s--) {
+ if (startTags[s].slice(0, startTags[s].indexOf(' ')).replace(/(\w)$/,'$1>') == rSlash(endTags[i])
+ && matched == false) {
+ cleanedTag = cleanedTag ? startTags[s] + cleanedTag : startTags[s];
+ matched = true;
+ }
+ };
+ }
+ }
+ }
+
+ endText = cleanedTag && cleanedTag + endText || endText;
+ }
+ $this.html([
+ startText,
+ '<span class="read-more">',
+ o.expandPrefix,
+ '<a href="#">',
+ o.expandText,
+ '</a>',
+ '</span>',
+ '<span class="details">',
+ endText,
+ '</span>'
+ ].join('')
+ );
+ }
+ var $thisDetails = $('span.details', this),
+ $readMore = $('span.read-more', this);
+ $thisDetails.hide();
+ $readMore.find('a').click(function() {
+ $readMore.hide();
+
+ if (o.expandEffect === 'show' && !o.expandSpeed) {
+ o.beforeExpand($this);
+ $thisDetails.show();
+ o.afterExpand($this);
+ delayCollapse(o, $thisDetails);
+ } else {
+ o.beforeExpand($this);
+ $thisDetails[o.expandEffect](o.expandSpeed, function() {
+ $thisDetails.css({zoom: ''});
+ o.afterExpand($this);
+ delayCollapse(o, $thisDetails);
+ });
+ }
+ return false;
+ });
+ if (o.userCollapse) {
+ $this
+ .find('span.details').append('<span class="re-collapse">' + o.userCollapsePrefix + '<a href="#">' + o.userCollapseText + '</a></span>');
+ $this.find('span.re-collapse a').click(function() {
+
+ clearTimeout(delayedCollapse);
+ var $detailsCollapsed = $(this).parents('span.details');
+ reCollapse($detailsCollapsed);
+ o.onCollapse($this, true);
+ return false;
+ });
+ }
+ });
+ function reCollapse(el) {
+ el.hide()
+ .prev('span.read-more').show();
+ }
+ function delayCollapse(option, $collapseEl) {
+ if (option.collapseTimer) {
+ delayedCollapse = setTimeout(function() {
+ reCollapse($collapseEl);
+ option.onCollapse($collapseEl.parent(), false);
+ },
+ option.collapseTimer
+ );
+ }
+ }
+ function rSlash(rString) {
+ return rString.replace(/\//,'');
+ }
+ };
+ // plugin defaults
+ $.fn.expander.defaults = {
+ slicePoint: 100, // the number of characters at which the contents will be sliced into two parts.
+ // Note: any tag names in the HTML that appear inside the sliced element before
+ // the slicePoint will be counted along with the text characters.
+ widow: 4, // a threshold of sorts for whether to initially hide/collapse part of the element's contents.
+ // If after slicing the contents in two there are fewer words in the second part than
+ // the value set by widow, we won't bother hiding/collapsing anything.
+ expandText: 'read more', // text displayed in a link instead of the hidden part of the element.
+ // clicking this will expand/show the hidden/collapsed text
+ expandPrefix: '… ',
+ collapseTimer: 0, // number of milliseconds after text has been expanded at which to collapse the text again
+ expandEffect: 'fadeIn',
+ expandSpeed: '', // speed in milliseconds of the animation effect for expanding the text
+ userCollapse: true, // allow the user to re-collapse the expanded text.
+ userCollapseText: '[collapse expanded text]', // text to use for the link to re-collapse the text
+ userCollapsePrefix: ' ',
+ beforeExpand: function($thisEl) {},
+ afterExpand: function($thisEl) {},
+ onCollapse: function($thisEl, byUser) {}
+ };
+})(jQuery);
15 years
moksha/public
by Luke Macken
moksha/public/javascript/jquery.expander.js | 152 ++++++++++++++++++++++++++++
1 file changed, 152 insertions(+)
New commits:
commit 7836ea9afcfd648d9794e74b0905dc29d43c9c6e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sun May 31 19:10:18 2009 -0400
Add the jquery.expander plugin to our static files
diff --git a/moksha/public/javascript/jquery.expander.js b/moksha/public/javascript/jquery.expander.js
new file mode 100644
index 0000000..f56eef0
--- /dev/null
+++ b/moksha/public/javascript/jquery.expander.js
@@ -0,0 +1,152 @@
+/*
+ * jQuery Expander plugin
+ * Version 0.4 (12/09/2008)
+ * @requires jQuery v1.1.1+
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+
+(function($) {
+
+ $.fn.expander = function(options) {
+
+ var opts = $.extend({}, $.fn.expander.defaults, options);
+ var delayedCollapse;
+ return this.each(function() {
+ var $this = $(this);
+ var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
+ var cleanedTag, startTags, endTags;
+ var allText = $this.html();
+ var startText = allText.slice(0, o.slicePoint).replace(/\w+$/,'');
+ startTags = startText.match(/<\w[^>]*>/g);
+ if (startTags) {startText = allText.slice(0,o.slicePoint + startTags.join('').length).replace(/\w+$/,'');}
+
+ if (startText.lastIndexOf('<') > startText.lastIndexOf('>') ) {
+ startText = startText.slice(0,startText.lastIndexOf('<'));
+ }
+ var endText = allText.slice(startText.length);
+ // create necessary expand/collapse elements if they don't already exist
+ if (!$('span.details', this).length) {
+ // end script if text length isn't long enough.
+ if ( endText.replace(/\s+$/,'').split(' ').length < o.widow ) { return; }
+ // otherwise, continue...
+ if (endText.indexOf('</') > -1) {
+ endTags = endText.match(/<(\/)?[^>]*>/g);
+ for (var i=0; i < endTags.length; i++) {
+
+ if (endTags[i].indexOf('</') > -1) {
+ var startTag, startTagExists = false;
+ for (var j=0; j < i; j++) {
+ startTag = endTags[j].slice(0, endTags[j].indexOf(' ')).replace(/(\w)$/,'$1>');
+ if (startTag == rSlash(endTags[i])) {
+ startTagExists = true;
+ }
+ }
+ if (!startTagExists) {
+ startText = startText + endTags[i];
+ var matched = false;
+ for (var s=startTags.length - 1; s >= 0; s--) {
+ if (startTags[s].slice(0, startTags[s].indexOf(' ')).replace(/(\w)$/,'$1>') == rSlash(endTags[i])
+ && matched == false) {
+ cleanedTag = cleanedTag ? startTags[s] + cleanedTag : startTags[s];
+ matched = true;
+ }
+ };
+ }
+ }
+ }
+
+ endText = cleanedTag && cleanedTag + endText || endText;
+ }
+ $this.html([
+ startText,
+ '<span class="read-more">',
+ o.expandPrefix,
+ '<a href="#">',
+ o.expandText,
+ '</a>',
+ '</span>',
+ '<span class="details">',
+ endText,
+ '</span>'
+ ].join('')
+ );
+ }
+ var $thisDetails = $('span.details', this),
+ $readMore = $('span.read-more', this);
+ $thisDetails.hide();
+ $readMore.find('a').click(function() {
+ $readMore.hide();
+
+ if (o.expandEffect === 'show' && !o.expandSpeed) {
+ o.beforeExpand($this);
+ $thisDetails.show();
+ o.afterExpand($this);
+ delayCollapse(o, $thisDetails);
+ } else {
+ o.beforeExpand($this);
+ $thisDetails[o.expandEffect](o.expandSpeed, function() {
+ $thisDetails.css({zoom: ''});
+ o.afterExpand($this);
+ delayCollapse(o, $thisDetails);
+ });
+ }
+ return false;
+ });
+ if (o.userCollapse) {
+ $this
+ .find('span.details').append('<span class="re-collapse">' + o.userCollapsePrefix + '<a href="#">' + o.userCollapseText + '</a></span>');
+ $this.find('span.re-collapse a').click(function() {
+
+ clearTimeout(delayedCollapse);
+ var $detailsCollapsed = $(this).parents('span.details');
+ reCollapse($detailsCollapsed);
+ o.onCollapse($this, true);
+ return false;
+ });
+ }
+ });
+ function reCollapse(el) {
+ el.hide()
+ .prev('span.read-more').show();
+ }
+ function delayCollapse(option, $collapseEl) {
+ if (option.collapseTimer) {
+ delayedCollapse = setTimeout(function() {
+ reCollapse($collapseEl);
+ option.onCollapse($collapseEl.parent(), false);
+ },
+ option.collapseTimer
+ );
+ }
+ }
+ function rSlash(rString) {
+ return rString.replace(/\//,'');
+ }
+ };
+ // plugin defaults
+ $.fn.expander.defaults = {
+ slicePoint: 100, // the number of characters at which the contents will be sliced into two parts.
+ // Note: any tag names in the HTML that appear inside the sliced element before
+ // the slicePoint will be counted along with the text characters.
+ widow: 4, // a threshold of sorts for whether to initially hide/collapse part of the element's contents.
+ // If after slicing the contents in two there are fewer words in the second part than
+ // the value set by widow, we won't bother hiding/collapsing anything.
+ expandText: 'read more', // text displayed in a link instead of the hidden part of the element.
+ // clicking this will expand/show the hidden/collapsed text
+ expandPrefix: '… ',
+ collapseTimer: 0, // number of milliseconds after text has been expanded at which to collapse the text again
+ expandEffect: 'fadeIn',
+ expandSpeed: '', // speed in milliseconds of the animation effect for expanding the text
+ userCollapse: true, // allow the user to re-collapse the expanded text.
+ userCollapseText: '[collapse expanded text]', // text to use for the link to re-collapse the text
+ userCollapsePrefix: ' ',
+ beforeExpand: function($thisEl) {},
+ afterExpand: function($thisEl) {},
+ onCollapse: function($thisEl, byUser) {}
+ };
+})(jQuery);
15 years
moksha/widgets
by Luke Macken
moksha/widgets/expander.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
New commits:
commit 1588163937b5d73f690751338c6a55171a3b486c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sun May 31 18:38:54 2009 -0400
Add a jQuery expander widget
diff --git a/moksha/widgets/expander.py b/moksha/widgets/expander.py
new file mode 100644
index 0000000..b283216
--- /dev/null
+++ b/moksha/widgets/expander.py
@@ -0,0 +1,26 @@
+# This file is part of Moksha
+# Copyright (C) 2008-2009 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+:mod:`fedoracommunity.widgets.expander` -- An Expander Widget
+=============================================================
+
+http://plugins.learningjquery.com/expander
+"""
+
+from tw.api import JSLink
+
+expander_js = JSLink(link='/javascript/jquery.expander.js')
15 years