[MERGE] trunk

bzr revid: al@openerp.com-20120721201123-3824izt73xvmk9vl
This commit is contained in:
Antony Lesuisse 2012-07-21 22:11:23 +02:00
commit 3611d585b3
444 changed files with 68201 additions and 59225 deletions

View File

@ -1,10 +1,10 @@
{
"name" : "web",
"name" : "Web",
"category": "Hidden",
"description":
"""
OpenERP Web core module.
This module provides the core of the OpenERP web client.
This module provides the core of the OpenERP Web Client.
""",
"depends" : [],
'auto_install': True,
@ -15,14 +15,12 @@
"static/lib/datejs/parser.js",
"static/lib/datejs/sugarpak.js",
"static/lib/datejs/extras.js",
"static/lib/jquery/jquery-1.7.2b1.js",
"static/lib/jquery/jquery-1.7.2.js",
"static/lib/jquery.MD5/jquery.md5.js",
"static/lib/jquery.form/jquery.form.js",
"static/lib/jquery.validate/jquery.validate.js",
"static/lib/jquery.ba-bbq/jquery.ba-bbq.js",
"static/lib/jquery.blockUI/jquery.blockUI.js",
"static/lib/jquery.superfish/js/hoverIntent.js",
"static/lib/jquery.superfish/js/superfish.js",
"static/lib/jquery.ui/js/jquery-ui-1.8.17.custom.min.js",
"static/lib/jquery.ui.timepicker/js/jquery-ui-timepicker-addon.js",
"static/lib/jquery.ui.notify/js/jquery.notify.js",
@ -30,13 +28,12 @@
"static/lib/jquery.scrollTo/jquery.scrollTo-min.js",
"static/lib/jquery.tipsy/jquery.tipsy.js",
"static/lib/jquery.textext/jquery.textext.js",
"static/lib/json/json2.js",
"static/lib/jquery.timeago/jquery.timeago.js",
"static/lib/qweb/qweb2.js",
"static/lib/underscore/underscore.js",
"static/lib/underscore/underscore.string.js",
"static/lib/backbone/backbone.js",
"static/lib/labjs/LAB.src.js",
"static/lib/cleditor/jquery.cleditor.js",
"static/lib/py.js/lib/py.js",
"static/src/js/boot.js",
"static/src/js/corelib.js",
@ -56,15 +53,15 @@
"static/src/js/view_editor.js"
],
'css' : [
"static/lib/jquery.superfish/css/superfish.css",
"static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.8.16.custom.css",
"static/lib/jquery.ui.timepicker/css/jquery-ui-timepicker-addon.css",
"static/lib/jquery.ui.notify/css/ui.notify.css",
"static/lib/jquery.tipsy/tipsy.css",
# "static/src/css/base_old.css",
"static/lib/jquery.textext/jquery.textext.css",
"static/src/css/base.css",
"static/src/css/data_export.css",
"static/src/css/data_import.css",
"static/lib/cleditor/jquery.cleditor.css",
],
'qweb' : [
"static/src/xml/*.xml",

View File

@ -28,6 +28,7 @@ import werkzeug.wsgi
from . import nonliterals
from . import session
from . import openerplib
import urlparse
__all__ = ['Root', 'jsonrequest', 'httprequest', 'Controller',
'WebRequest', 'JsonRequest', 'HttpRequest']
@ -332,12 +333,9 @@ def httprequest(f):
# OpenERP Web werkzeug Session Managment wraped using with
#----------------------------------------------------------
STORES = {}
SESSION_TIMEOUT = 7 * 24 * 60 * 60 # FIXME make it configurable ?
SESSION_COUNTER = 0
@contextlib.contextmanager
def session_context(request, storage_path, session_cookie='sessionid'):
global SESSION_COUNTER
session_store, session_lock = STORES.get(storage_path, (None, None))
if not session_store:
session_store = werkzeug.contrib.sessions.FilesystemSessionStore(
@ -347,22 +345,10 @@ def session_context(request, storage_path, session_cookie='sessionid'):
sid = request.cookies.get(session_cookie)
with session_lock:
SESSION_COUNTER += 1
if SESSION_COUNTER % 100 == 0:
SESSION_COUNTER = 0
for s in session_store.list():
ss = session_store.get(s)
t = ss.get('timestamp')
if not t or t + SESSION_TIMEOUT < time.time():
_logger.debug('deleting http session %s', s)
session_store.delete(ss)
if sid:
request.session = session_store.get(sid)
else:
request.session = session_store.new()
request.session['timestamp'] = time.time()
try:
yield request.session
@ -379,7 +365,7 @@ def session_context(request, storage_path, session_cookie='sessionid'):
and not value.jsonp_requests
# FIXME do not use a fixed value
and value._creation_time + (60*5) < time.time()):
_logger.debug('remove OpenERP session %s', key)
_logger.debug('remove session %s', key)
removed_sessions.add(key)
del request.session[key]
@ -432,6 +418,20 @@ class ControllerType(type):
class Controller(object):
__metaclass__ = ControllerType
class DisableCacheMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
def start_wrapped(status, headers):
referer = environ.get('HTTP_REFERER', '')
parsed = urlparse.urlparse(referer)
debug = not urlparse.parse_qs(parsed.query).has_key('debug')
filtered_headers = [(k,v) for k,v in headers if not (k=='Last-Modified' or (debug and k=='Cache-Control'))]
if debug:
filtered_headers.append(('Cache-Control', 'no-cache'))
start_response(status, filtered_headers)
return self.app(environ, start_wrapped)
class Root(object):
"""Root WSGI application for the OpenERP Web Client.
@ -467,8 +467,8 @@ class Root(object):
static_dirs = self._load_addons(openerp_addons_namespace)
if options.serve_static:
self.dispatch = werkzeug.wsgi.SharedDataMiddleware(
self.dispatch, static_dirs)
app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs)
self.dispatch = DisableCacheMiddleware(app)
if options.session_storage:
if not os.path.exists(options.session_storage):
@ -603,26 +603,22 @@ class LocalConnector(openerplib.Connector):
import openerp
import traceback
import xmlrpclib
code_string = "warning -- %s\n\n%s"
try:
result = openerp.netsvc.dispatch_rpc(service_name, method, args)
except Exception,e:
return openerp.netsvc.dispatch_rpc(service_name, method, args)
except openerp.osv.osv.except_osv, e:
# TODO change the except to raise LibException instead of their emulated xmlrpc fault
if isinstance(e, openerp.osv.osv.except_osv):
fault = xmlrpclib.Fault('warning -- ' + e.name + '\n\n' + str(e.value), '')
elif isinstance(e, openerp.exceptions.Warning):
fault = xmlrpclib.Fault('warning -- Warning\n\n' + str(e), '')
elif isinstance(e, openerp.exceptions.AccessError):
fault = xmlrpclib.Fault('warning -- AccessError\n\n' + str(e), '')
elif isinstance(e, openerp.exceptions.AccessDenied):
fault = xmlrpclib.Fault('AccessDenied', str(e))
elif isinstance(e, openerp.exceptions.DeferredException):
info = e.traceback
formatted_info = "".join(traceback.format_exception(*info))
fault = xmlrpclib.Fault(openerp.tools.ustr(e.message), formatted_info)
else:
info = sys.exc_info()
formatted_info = "".join(traceback.format_exception(*info))
fault = xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
raise fault
return result
raise xmlrpclib.Fault(code_string % (e.name, e.value), '')
except openerp.exceptions.Warning, e:
raise xmlrpclib.Fault(code_string % ("Warning", e), '')
except openerp.exceptions.AccessError, e:
raise xmlrpclib.Fault(code_string % ("AccessError", e), '')
except openerp.exceptions.AccessDenied, e:
raise xmlrpclib.Fault('AccessDenied', str(e))
except openerp.exceptions.DeferredException, e:
formatted_info = "".join(traceback.format_exception(*e.traceback))
raise xmlrpclib.Fault(openerp.tools.ustr(e.message), formatted_info)
except Exception, e:
formatted_info = "".join(traceback.format_exception(*(sys.exc_info())))
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)

View File

@ -194,7 +194,9 @@ class WebClient(openerpweb.Controller):
if mods is not None:
path += '?mods=' + mods
return [path]
return ['%s?debug=%s' % (wp, os.path.getmtime(fp)) for fp, wp in self.manifest_glob(req, mods, extension)]
# old code to force cache reloading
#return ['%s?debug=%s' % (wp, os.path.getmtime(fp)) for fp, wp in self.manifest_glob(req, mods, extension)]
return [el[1] for el in self.manifest_glob(req, mods, extension)]
@openerpweb.jsonrequest
def csslist(self, req, mods=None):
@ -256,8 +258,7 @@ class WebClient(openerpweb.Controller):
file_map = dict(files)
rx_import = re.compile(r"""@import\s+('|")(?!'|"|/|https?://)""", re.U)
rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://)""", re.U)
rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://|data:)""", re.U)
def reader(f):
"""read the a css file and absolutify all relative uris"""
@ -437,18 +438,21 @@ class Database(openerpweb.Controller):
@openerpweb.httprequest
def backup(self, req, backup_db, backup_pwd, token):
db_dump = base64.b64decode(
req.session.proxy("db").dump(backup_pwd, backup_db))
filename = "%(db)s_%(timestamp)s.dump" % {
'db': backup_db,
'timestamp': datetime.datetime.utcnow().strftime(
"%Y-%m-%d_%H-%M-%SZ")
}
return req.make_response(db_dump,
[('Content-Type', 'application/octet-stream; charset=binary'),
('Content-Disposition', 'attachment; filename="' + filename + '"')],
{'fileToken': int(token)}
)
try:
db_dump = base64.b64decode(
req.session.proxy("db").dump(backup_pwd, backup_db))
filename = "%(db)s_%(timestamp)s.dump" % {
'db': backup_db,
'timestamp': datetime.datetime.utcnow().strftime(
"%Y-%m-%d_%H-%M-%SZ")
}
return req.make_response(db_dump,
[('Content-Type', 'application/octet-stream; charset=binary'),
('Content-Disposition', 'attachment; filename="' + filename + '"')],
{'fileToken': int(token)}
)
except xmlrpclib.Fault, e:
return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]])
@openerpweb.httprequest
def restore(self, req, db_file, restore_pwd, new_db):
@ -735,10 +739,10 @@ def clean_action(req, action, do_not_eval=False):
if not do_not_eval:
# values come from the server, we can just eval them
if isinstance(action.get('context'), basestring):
if action.get('context') and isinstance(action.get('context'), basestring):
action['context'] = eval( action['context'], eval_ctx ) or {}
if isinstance(action.get('domain'), basestring):
if action.get('domain') and isinstance(action.get('domain'), basestring):
action['domain'] = eval( action['domain'], eval_ctx ) or []
else:
if 'context' in action:
@ -771,7 +775,7 @@ def generate_views(action):
:param dict action: action descriptor dictionary to generate a views key for
"""
view_id = action.get('view_id', False)
view_id = action.get('view_id') or False
if isinstance(view_id, (list, tuple)):
view_id = view_id[0]
@ -1286,12 +1290,14 @@ class SearchView(View):
del filter['context']
del filter['domain']
return filters
@openerpweb.jsonrequest
def add_to_dashboard(self, req, menu_id, action_id, context_to_save, domain, view_mode, name=''):
ctx = common.nonliterals.CompoundContext(context_to_save)
ctx.session = req.session
ctx = ctx.evaluate()
to_eval = common.nonliterals.CompoundContext(context_to_save)
to_eval.session = req.session
ctx = dict((k, v) for k, v in to_eval.evaluate().iteritems()
if not k.startswith('search_default_'))
ctx['dashboard_merge_domains_contexts'] = False # TODO: replace this 6.1 workaround by attribute on <action/>
domain = common.nonliterals.CompoundDomain(domain)
domain.session = req.session
@ -1331,22 +1337,53 @@ class Binary(openerpweb.Controller):
@openerpweb.httprequest
def image(self, req, model, id, field, **kw):
last_update = '__last_update'
Model = req.session.model(model)
context = req.session.eval_context(req.context)
headers = [('Content-Type', 'image/png')]
etag = req.httprequest.headers.get('If-None-Match')
hashed_session = hashlib.md5(req.session_id).hexdigest()
if etag:
if not id and hashed_session == etag:
return werkzeug.wrappers.Response(status=304)
else:
date = Model.read([int(id)], [last_update], context)[0].get(last_update)
if hashlib.md5(date).hexdigest() == etag:
return werkzeug.wrappers.Response(status=304)
retag = hashed_session
try:
if not id:
res = Model.default_get([field], context).get(field)
image_data = base64.b64decode(res)
else:
res = Model.read([int(id)], [field], context)[0].get(field)
image_data = base64.b64decode(res)
res = Model.read([int(id)], [last_update, field], context)[0]
retag = hashlib.md5(res.get(last_update)).hexdigest()
image_data = base64.b64decode(res.get(field))
except (TypeError, xmlrpclib.Fault):
image_data = self.placeholder(req)
return req.make_response(image_data, [
('Content-Type', 'image/png'), ('Content-Length', len(image_data))])
headers.append(('ETag', retag))
headers.append(('Content-Length', len(image_data)))
try:
ncache = int(kw.get('cache'))
headers.append(('Cache-Control', 'no-cache' if ncache == 0 else 'max-age=%s' % (ncache)))
except:
pass
return req.make_response(image_data, headers)
def placeholder(self, req):
addons_path = openerpweb.addons_manifest['web']['addons_path']
return open(os.path.join(addons_path, 'web', 'static', 'src', 'img', 'placeholder.png'), 'rb').read()
def content_disposition(self, filename, req):
filename = filename.encode('utf8')
escaped = urllib2.quote(filename)
browser = req.httprequest.user_agent.browser
version = int((req.httprequest.user_agent.version or '0').split('.')[0])
if browser == 'msie' and version < 9:
return "attachment; filename=%s" % escaped
elif browser == 'safari':
return "attachment; filename=%s" % filename
else:
return "attachment; filename*=UTF-8''%s" % escaped
@openerpweb.httprequest
def saveas(self, req, model, field, id=None, filename_field=None, **kw):
@ -1382,7 +1419,7 @@ class Binary(openerpweb.Controller):
filename = res.get(filename_field, '') or filename
return req.make_response(filecontent,
[('Content-Type', 'application/octet-stream'),
('Content-Disposition', 'attachment; filename="%s"' % filename)])
('Content-Disposition', self.content_disposition(filename, req))])
@openerpweb.httprequest
def saveas_ajax(self, req, data, token):
@ -1412,7 +1449,7 @@ class Binary(openerpweb.Controller):
filename = res.get(filename_field, '') or filename
return req.make_response(filecontent,
headers=[('Content-Type', 'application/octet-stream'),
('Content-Disposition', 'attachment; filename="%s"' % filename)],
('Content-Disposition', self.content_disposition(filename, req))],
cookies={'fileToken': int(token)})
@openerpweb.httprequest
@ -1420,16 +1457,8 @@ class Binary(openerpweb.Controller):
# TODO: might be useful to have a configuration flag for max-length file uploads
try:
out = """<script language="javascript" type="text/javascript">
var win = window.top.window,
callback = win[%s];
if (typeof(callback) === 'function') {
callback.apply(this, %s);
} else {
win.jQuery('#oe_notification', win.document).notify('create', {
title: "Ajax File Upload",
text: "Could not find callback"
});
}
var win = window.top.window;
win.jQuery(win).trigger(%s, %s);
</script>"""
data = ufile.read()
args = [len(data), ufile.filename,
@ -1444,11 +1473,8 @@ class Binary(openerpweb.Controller):
Model = req.session.model('ir.attachment')
try:
out = """<script language="javascript" type="text/javascript">
var win = window.top.window,
callback = win[%s];
if (typeof(callback) === 'function') {
callback.call(this, %s);
}
var win = window.top.window;
win.jQuery(win).trigger(%s, %s);
</script>"""
attachment_id = Model.create({
'name': ufile.filename,
@ -1467,7 +1493,10 @@ class Binary(openerpweb.Controller):
class Action(openerpweb.Controller):
_cp_path = "/web/action"
# For most actions, the type attribute and the model name are the same, but
# there are exceptions. This dict is used to remap action type attributes
# to the "real" model name when they differ.
action_mapping = {
"ir.actions.act_url": "ir.actions.url",
}
@ -1477,14 +1506,25 @@ class Action(openerpweb.Controller):
Actions = req.session.model('ir.actions.actions')
value = False
context = req.session.eval_context(req.context)
action_type = Actions.read([action_id], ['type'], context)
if action_type:
try:
action_id = int(action_id)
except ValueError:
try:
module, xmlid = action_id.split('.', 1)
model, action_id = req.session.model('ir.model.data').get_object_reference(module, xmlid)
assert model.startswith('ir.actions.')
except Exception:
action_id = 0 # force failed read
base_action = Actions.read([action_id], ['type'], context)
if base_action:
ctx = {}
if action_type[0]['type'] == 'ir.actions.report.xml':
action_type = base_action[0]['type']
if action_type == 'ir.actions.report.xml':
ctx.update({'bin_size': True})
ctx.update(context)
action_model = action_type[0]['type']
action_model = Action.action_mapping.get(action_model, action_model)
action_model = self.action_mapping.get(action_type, action_type)
action = req.session.model(action_model).read([action_id], False, ctx)
if action:
value = clean_action(req, action[0], do_not_eval)
@ -1492,8 +1532,12 @@ class Action(openerpweb.Controller):
@openerpweb.jsonrequest
def run(self, req, action_id):
return clean_action(req, req.session.model('ir.actions.server').run(
[action_id], req.session.eval_context(req.context)))
return_action = req.session.model('ir.actions.server').run(
[action_id], req.session.eval_context(req.context))
if return_action:
return clean_action(req, return_action)
else:
return False
class Export(View):
_cp_path = "/web/export"
@ -1805,15 +1849,20 @@ class Reports(View):
report = zlib.decompress(report)
report_mimetype = self.TYPES_MAPPING.get(
report_struct['format'], 'octet-stream')
file_name = None
if 'name' not in action:
reports = req.session.model('ir.actions.report.xml')
res_id = reports.search([('report_name', '=',action['report_name']),],
res_id = reports.search([('report_name', '=', action['report_name']),],
0, False, False, context)
action['name'] = reports.read(res_id, ['name'], context)[0]['name']
if len(res_id) > 0:
file_name = reports.read(res_id[0], ['name'], context)['name']
else:
file_name = action['report_name']
return req.make_response(report,
headers=[
('Content-Disposition', 'attachment; filename="%s.%s"' % (action['name'], report_struct['format'])),
# maybe we should take of what characters can appear in a file name?
('Content-Disposition', 'attachment; filename="%s.%s"' % (file_name, report_struct['format'])),
('Content-Type', report_mimetype),
('Content-Length', len(report))],
cookies={'fileToken': int(token)})
@ -1872,10 +1921,14 @@ class Import(View):
return '<script>window.top.%s(%s);</script>' % (
jsonp, simplejson.dumps({'error': {'message': error}}))
# skip ignored records
data_record = itertools.islice(
csv.reader(csvfile, quotechar=str(csvdel), delimiter=str(csvsep)),
skip, None)
# skip ignored records (@skip parameter)
# then skip empty lines (not valid csv)
# nb: should these operations be reverted?
rows_to_import = itertools.ifilter(
None,
itertools.islice(
csv.reader(csvfile, quotechar=str(csvdel), delimiter=str(csvsep)),
skip, None))
# if only one index, itemgetter will return an atom rather than a tuple
if len(indices) == 1: mapper = lambda row: [row[indices[0]]]
@ -1887,7 +1940,7 @@ class Import(View):
# decode each data row
data = [
[record.decode(csvcode) for record in row]
for row in itertools.imap(mapper, data_record)
for row in itertools.imap(mapper, rows_to_import)
# don't insert completely empty rows (can happen due to fields
# filtering in case of e.g. o2m content rows)
if any(row)

File diff suppressed because it is too large Load Diff

1549
addons/web/i18n/bg.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1549
addons/web/i18n/ca.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1565
addons/web/i18n/hi.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@ -0,0 +1,24 @@
.cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white}
.cleditorMain iframe {border:none; margin:0; padding:0}
.cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */}
.cleditorToolbar {background: url('images/toolbar.gif') repeat}
.cleditorGroup {float:left; height:26px}
.cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('images/buttons.gif')}
.cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}
.cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}
.cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
.cleditorList div {padding:2px 4px 2px 4px}
.cleditorList p,
.cleditorList h1,
.cleditorList h2,
.cleditorList h3,
.cleditorList h4,
.cleditorList h5,
.cleditorList h6,
.cleditorList font {padding:0; margin:0; background-color:Transparent}
.cleditorColor {width:150px; padding:1px 0 0 1px}
.cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0}
.cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt}
.cleditorPrompt input,
.cleditorPrompt textarea {font:8.5pt Arial,Verdana;}
.cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
/*
CLEditor WYSIWYG HTML Editor v1.3.0
http://premiumsoftware.net/cleditor
requires jQuery v1.4.2 or later
Copyright 2010, Chris Landowski, Premium Software, LLC
Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(e){function aa(a){var b=this,c=a.target,d=e.data(c,x),h=s[d],f=h.popupName,i=p[f];if(!(b.disabled||e(c).attr(n)==n)){var g={editor:b,button:c,buttonName:d,popup:i,popupName:f,command:h.command,useCSS:b.options.useCSS};if(h.buttonClick&&h.buttonClick(a,g)===false)return false;if(d=="source"){if(t(b)){delete b.range;b.$area.hide();b.$frame.show();c.title=h.title}else{b.$frame.hide();b.$area.show();c.title="Show Rich Text"}setTimeout(function(){u(b)},100)}else if(!t(b))if(f){var j=e(i);if(f==
"url"){if(d=="link"&&M(b)===""){z(b,"A selection is required when inserting a link.",c);return false}j.children(":button").unbind(q).bind(q,function(){var k=j.find(":text"),o=e.trim(k.val());o!==""&&v(b,g.command,o,null,g.button);k.val("http://");r();w(b)})}else f=="pastetext"&&j.children(":button").unbind(q).bind(q,function(){var k=j.find("textarea"),o=k.val().replace(/\n/g,"<br />");o!==""&&v(b,g.command,o,null,g.button);k.val("");r();w(b)});if(c!==e.data(i,A)){N(b,i,c);return false}return}else if(d==
"print")b.$frame[0].contentWindow.print();else if(!v(b,g.command,g.value,g.useCSS,c))return false;w(b)}}function O(a){a=e(a.target).closest("div");a.css(H,a.data(x)?"#FFF":"#FFC")}function P(a){e(a.target).closest("div").css(H,"transparent")}function ba(a){var b=a.data.popup,c=a.target;if(!(b===p.msg||e(b).hasClass(B))){var d=e.data(b,A),h=e.data(d,x),f=s[h],i=f.command,g,j=this.options.useCSS;if(h=="font")g=c.style.fontFamily.replace(/"/g,"");else if(h=="size"){if(c.tagName=="DIV")c=c.children[0];
g=c.innerHTML}else if(h=="style")g="<"+c.tagName+">";else if(h=="color")g=Q(c.style.backgroundColor);else if(h=="highlight"){g=Q(c.style.backgroundColor);if(l)i="backcolor";else j=true}b={editor:this,button:d,buttonName:h,popup:b,popupName:f.popupName,command:i,value:g,useCSS:j};if(!(f.popupClick&&f.popupClick(a,b)===false)){if(b.command&&!v(this,b.command,b.value,b.useCSS,d))return false;r();w(this)}}}function C(a){for(var b=1,c=0,d=0;d<a.length;++d){b=(b+a.charCodeAt(d))%65521;c=(c+b)%65521}return c<<
16|b}function R(a,b,c,d,h){if(p[a])return p[a];var f=e(m).hide().addClass(ca).appendTo("body");if(d)f.html(d);else if(a=="color"){b=b.colors.split(" ");b.length<10&&f.width("auto");e.each(b,function(i,g){e(m).appendTo(f).css(H,"#"+g)});c=da}else if(a=="font")e.each(b.fonts.split(","),function(i,g){e(m).appendTo(f).css("fontFamily",g).html(g)});else if(a=="size")e.each(b.sizes.split(","),function(i,g){e(m).appendTo(f).html("<font size="+g+">"+g+"</font>")});else if(a=="style")e.each(b.styles,function(i,
g){e(m).appendTo(f).html(g[1]+g[0]+g[1].replace("<","</"))});else if(a=="url"){f.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');c=B}else if(a=="pastetext"){f.html("Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>");c=B}if(!c&&!d)c=S;f.addClass(c);l&&f.attr(I,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(I,"on");if(f.hasClass(S)||h===true)f.children().hover(O,P);p[a]=f[0];
return f[0]}function T(a,b){if(b){a.$area.attr(n,n);a.disabled=true}else{a.$area.removeAttr(n);delete a.disabled}try{if(l)a.doc.body.contentEditable=!b;else a.doc.designMode=!b?"on":"off"}catch(c){}u(a)}function v(a,b,c,d,h){D(a);if(!l){if(d===undefined||d===null)d=a.options.useCSS;a.doc.execCommand("styleWithCSS",0,d.toString())}d=true;var f;if(l&&b.toLowerCase()=="inserthtml")y(a).pasteHTML(c);else{try{d=a.doc.execCommand(b,0,c||null)}catch(i){f=i.description;d=false}d||("cutcopypaste".indexOf(b)>
-1?z(a,"For security reasons, your browser does not support the "+b+" command. Try using the keyboard shortcut or context menu instead.",h):z(a,f?f:"Error executing the "+b+" command.",h))}u(a);return d}function w(a){setTimeout(function(){t(a)?a.$area.focus():a.$frame[0].contentWindow.focus();u(a)},0)}function y(a){if(l)return J(a).createRange();return J(a).getRangeAt(0)}function J(a){if(l)return a.doc.selection;return a.$frame[0].contentWindow.getSelection()}function Q(a){var b=/rgba?\((\d+), (\d+), (\d+)/.exec(a),
c=a.split("");if(b)for(a=(b[1]<<16|b[2]<<8|b[3]).toString(16);a.length<6;)a="0"+a;return"#"+(a.length==6?a:c[1]+c[1]+c[2]+c[2]+c[3]+c[3])}function r(){e.each(p,function(a,b){e(b).hide().unbind(q).removeData(A)})}function U(){var a=e("link[href$='jquery.cleditor.css']").attr("href");return a.substr(0,a.length-19)+"images/"}function K(a){var b=a.$main,c=a.options;a.$frame&&a.$frame.remove();var d=a.$frame=e('<iframe frameborder="0" src="javascript:true;">').hide().appendTo(b),h=d[0].contentWindow,f=
a.doc=h.document,i=e(f);f.open();f.write(c.docType+"<html>"+(c.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+c.docCSSFile+'" /></head>')+'<body style="'+c.bodyStyle+'"></body></html>');f.close();l&&i.click(function(){w(a)});E(a);if(l){i.bind("beforedeactivate beforeactivate selectionchange keypress",function(g){if(g.type=="beforedeactivate")a.inactive=true;else if(g.type=="beforeactivate"){!a.inactive&&a.range&&a.range.length>1&&a.range.shift();delete a.inactive}else if(!a.inactive){if(!a.range)a.range=
[];for(a.range.unshift(y(a));a.range.length>2;)a.range.pop()}});d.focus(function(){D(a)})}(e.browser.mozilla?i:e(h)).blur(function(){V(a,true)});i.click(r).bind("keyup mouseup",function(){u(a)});L?a.$area.show():d.show();e(function(){var g=a.$toolbar,j=g.children("div:last"),k=b.width();j=j.offset().top+j.outerHeight()-g.offset().top+1;g.height(j);j=(/%/.test(""+c.height)?b.height():parseInt(c.height))-j;d.width(k).height(j);a.$area.width(k).height(ea?j-2:j);T(a,a.disabled);u(a)})}function u(a){if(!L&&
e.browser.webkit&&!a.focused){a.$frame[0].contentWindow.focus();window.focus();a.focused=true}var b=a.doc;if(l)b=y(a);var c=t(a);e.each(a.$toolbar.find("."+W),function(d,h){var f=e(h),i=e.cleditor.buttons[e.data(h,x)],g=i.command,j=true;if(a.disabled)j=false;else if(i.getEnabled){j=i.getEnabled({editor:a,button:h,buttonName:i.name,popup:p[i.popupName],popupName:i.popupName,command:i.command,useCSS:a.options.useCSS});if(j===undefined)j=true}else if((c||L)&&i.name!="source"||l&&(g=="undo"||g=="redo"))j=
false;else if(g&&g!="print"){if(l&&g=="hilitecolor")g="backcolor";if(!l||g!="inserthtml")try{j=b.queryCommandEnabled(g)}catch(k){j=false}}if(j){f.removeClass(X);f.removeAttr(n)}else{f.addClass(X);f.attr(n,n)}})}function D(a){l&&a.range&&a.range[0].select()}function M(a){D(a);if(l)return y(a).text;return J(a).toString()}function z(a,b,c){var d=R("msg",a.options,fa);d.innerHTML=b;N(a,d,c)}function N(a,b,c){var d,h,f=e(b);if(c){var i=e(c);d=i.offset();h=--d.left;d=d.top+i.height()}else{i=a.$toolbar;
d=i.offset();h=Math.floor((i.width()-f.width())/2)+d.left;d=d.top+i.height()-2}r();f.css({left:h,top:d}).show();if(c){e.data(b,A,c);f.bind(q,{popup:b},e.proxy(ba,a))}setTimeout(function(){f.find(":text,textarea").eq(0).focus().select()},100)}function t(a){return a.$area.is(":visible")}function E(a,b){var c=a.$area.val(),d=a.options,h=d.updateFrame,f=e(a.doc.body);if(h){var i=C(c);if(b&&a.areaChecksum==i)return;a.areaChecksum=i}c=h?h(c):c;c=c.replace(/<(?=\/?script)/ig,"&lt;");if(d.updateTextArea)a.frameChecksum=
C(c);if(c!=f.html()){f.html(c);e(a).triggerHandler(F)}}function V(a,b){var c=e(a.doc.body).html(),d=a.options,h=d.updateTextArea,f=a.$area;if(h){var i=C(c);if(b&&a.frameChecksum==i)return;a.frameChecksum=i}c=h?h(c):c;if(d.updateFrame)a.areaChecksum=C(c);if(c!=f.val()){f.val(c);e(a).triggerHandler(F)}}e.cleditor={defaultOptions:{width:500,height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",
colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],
["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:false,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},
imagesPath:function(){return U()}};e.fn.cleditor=function(a){var b=e([]);this.each(function(c,d){if(d.tagName=="TEXTAREA"){var h=e.data(d,Y);h||(h=new cleditor(d,a));b=b.add(h)}});return b};var H="backgroundColor",A="button",x="buttonName",F="change",Y="cleditor",q="click",n="disabled",m="<div>",I="unselectable",W="cleditorButton",X="cleditorDisabled",ca="cleditorPopup",S="cleditorList",da="cleditorColor",B="cleditorPrompt",fa="cleditorMsg",l=e.browser.msie,ea=/msie\s6/i.test(navigator.userAgent),
L=/iphone|ipad|ipod/i.test(navigator.userAgent),p={},Z,s=e.cleditor.buttons;e.each(s.init.split("|"),function(a,b){var c=b.split(","),d=c[0];s[d]={stripIndex:a,name:d,title:c[1]===""?d.charAt(0).toUpperCase()+d.substr(1):c[1],command:c[2]===""?d:c[2],popupName:c[3]===""?d:c[3]}});delete s.init;cleditor=function(a,b){var c=this;c.options=b=e.extend({},e.cleditor.defaultOptions,b);var d=c.$area=e(a).hide().data(Y,c).blur(function(){E(c,true)}),h=c.$main=e(m).addClass("cleditorMain").width(b.width).height(b.height),
f=c.$toolbar=e(m).addClass("cleditorToolbar").appendTo(h),i=e(m).addClass("cleditorGroup").appendTo(f);e.each(b.controls.split(" "),function(g,j){if(j==="")return true;if(j=="|"){e(m).addClass("cleditorDivider").appendTo(i);i=e(m).addClass("cleditorGroup").appendTo(f)}else{var k=s[j],o=e(m).data(x,k.name).addClass(W).attr("title",k.title).bind(q,e.proxy(aa,c)).appendTo(i).hover(O,P),G={};if(k.css)G=k.css;else if(k.image)G.backgroundImage="url("+U()+k.image+")";if(k.stripIndex)G.backgroundPosition=
k.stripIndex*-24;o.css(G);l&&o.attr(I,"on");k.popupName&&R(k.popupName,b,k.popupClass,k.popupContent,k.popupHover)}});h.insertBefore(d).append(d);if(!Z){e(document).click(function(g){g=e(g.target);g.add(g.parents()).is("."+B)||r()});Z=true}/auto|%/.test(""+b.width+b.height)&&e(window).resize(function(){K(c)});K(c)};var $=cleditor.prototype;e.each([["clear",function(a){a.$area.val("");E(a)}],["disable",T],["execCommand",v],["focus",w],["hidePopups",r],["sourceMode",t,true],["refresh",K],["select",
function(a){setTimeout(function(){t(a)?a.$area.select():v(a,"selectall")},0)}],["selectedHTML",function(a){D(a);a=y(a);if(l)return a.htmlText;var b=e("<layer>")[0];b.appendChild(a.cloneContents());return b.innerHTML},true],["selectedText",M,true],["showMessage",z],["updateFrame",E],["updateTextArea",V]],function(a,b){$[b[0]]=function(){for(var c=[this],d=0;d<arguments.length;d++)c.push(arguments[d]);c=b[1].apply(this,c);if(b[2])return c;return this}});$.change=function(a){var b=e(this);return a?b.bind(F,
a):b.trigger(F)}})(jQuery);

View File

@ -1,74 +0,0 @@
Changelog for Superfish - a jQuery menu plugin
v1.2.1: altered 2nd July 07. added hide() before animate to make work for jQuery 1.1.3.
v1.2.2: altered 2nd August 07. changed over function .find('ul') to .find('>ul') for smoother animations
Also deleted the iframe removal lines - not necessary it turns out
v1.2.3: altered jquery 1.1.3.1 broke keyboard access - had to change quite a few things and set display:none on the
.superfish rule in CSS instead of top:-999em
v1.3: Pretty much a complete overhaul to make all original features work in 1.1.3.1 and above.
.superfish rule reverted back to top:-999em (which is better).
v1.3.1: altered 'li[ul]' to $('li:has(ul)') to work with jQuery 1.2
v1.3.2: added onshow callback option as requested - 'this' keyword refers to revealed ul.
fixed bug whereby multiple menus on a page shared options. Now each menu can have separate options.
fixed IE6 and IE7 bug whereby under certain circumstances => 3rd tier menus appear instantly with text missing when revisited
v1.3.3: altered event attachment selectors for performance increase on menu setup.
v1.3.4: fixed pathClass bug as current path was not being restored. Still doesn't if using keyboard nav (will work on that).
v1.4: store options objects in array $.superfish.o. Also provide public access to $.superfish.defaults
provided backward compat for jQuery versions less than 1.2 via oldJquery option - will use li[ul] or li:has(ul) as needed
added more callbacks, also added option to disable hoverIntent usage if that plugin is detected
v1.4.1: fixed current path not being restored when using keyboard to tab away from the menu completely
optimised code further - now less code
removed addself() in favour of backward compatible add(this)
also remove new mouseenter/mouseleave events on window.unload (due to paranoia)
v1.4.2: 3rd July 2008. added semi-colon at start of superfish.js file to avert script concatenation errors
added pathLevels option to limit the depth of submenus that get restored by pathClass
CSS of main example hugely simplified - other example CSS files less-so.
- top level menu items are not fixed width
- only need to set submenu widths in one place.
- various other improvements.
- class names used in all CSS files are changed to be less generic
released optional Supersubs plugin which dynamically adjusts submenu widths
attach everything to jQuery.fn.superfish to clean up jQuery namespace
removed the multi-tier-all-horizontal-example as it was never a great idea and doesn't seem to be in use
Update documentation text and remove certain caveats which were there to support users of much older versions of Superfish
Documentation now show how to apply bgIgrame 2.1 - it's much easier than before
Add all links and their focus and blur events to the onunload unbind - paranoid about memory leaks
v1.4.3 5th July 2008. documentation completely redone using Mike Alsup's templates.
CSS revised so that all types of menu use superfish.css as a base. Include additional CSS files to acheive alternate styles.
class="sf-menu sf-vertical" creates vertical menu, class="sf-menu sf-navbar" creates nav-bar style menu
v1.4.4 7th July 2008. arrows feature added. If option 'autoArrows' is true, auto-appends (spans) to anchors that have a ul submenu sibling,
and adds class 'sf-with-ul' to anchor.
CSS added to style new arrows, including an 8-bit alpha (NOT INDEXED!) transparent png of arrow - degrades to solid for IE6.
Manually add arrow mark-up to docs and disable autoArrows (via defaults option) to maintain decent performance (for docs page)
Update docs, including zip download, to suit.
Fix CSS bug that had the third tier of the navbar-style menu visible when JS not available.
v1.4.5 9 July 2008. decreased code weight
added drop shadows for capable browsers - added css and 8-bit alpha transparent png image for shadow
remove support for jQuery v<1.2
remove unload clean-up which was there to solve garbage collection problems in early jQuery versions
remove toggling 'visibility' on hide and show which as a fix for an IE bug that is no longer exhibited
removed need for getOpts, rewrote getMenu
use [].join('') instead of string concatenation for performance increase - probably very slight in this case
change selector in 'over' function from '.'+o.hoverClass to 'li.'+o.hoverClass
v1.4.6 added workaround for IE7 shadows. If animation alters opacity then shadow is hidden during the animation and appears after.
This required some JS and a line of CSS, so created shortcut references to lighten code further.
v1.4.7 added back in the visibility toggle that was removed in 1.4.5 as the bug is indeed still exhibited by IE6 & 7
tweaked the look of the shadow slightly and use nicer 32bit png as I now find they behave the same as 8bit png with regard to fades in IE7
v1.4.8 fix over-sight: using 32bit png meant that the shadow image did show in IE6. Rather than go back to 8bit, add code to exclude IE6 from getting shadow class.
use new folder structure recommended by Matt from TopicTrack, for easier updates.

View File

@ -1,93 +0,0 @@
/*** adding the class sf-navbar in addition to sf-menu creates an all-horizontal nav-bar menu ***/
.sf-navbar {
background: #BDD2FF;
height: 2.5em;
padding-bottom: 2.5em;
position: relative;
}
.sf-navbar li {
background: #AABDE6;
position: static;
}
.sf-navbar a {
border-top: none;
}
.sf-navbar li ul {
width: 44em; /*IE6 soils itself without this*/
}
.sf-navbar li li {
background: #BDD2FF;
position: relative;
}
.sf-navbar li li ul {
width: 13em;
}
.sf-navbar li li li {
width: 100%;
}
.sf-navbar ul li {
width: auto;
float: left;
}
.sf-navbar a, .sf-navbar a:visited {
border: none;
}
.sf-navbar li.current {
background: #BDD2FF;
}
.sf-navbar li:hover,
.sf-navbar li.sfHover,
.sf-navbar li li.current,
.sf-navbar a:focus, .sf-navbar a:hover, .sf-navbar a:active {
background: #BDD2FF;
}
.sf-navbar ul li:hover,
.sf-navbar ul li.sfHover,
ul.sf-navbar ul li:hover li,
ul.sf-navbar ul li.sfHover li,
.sf-navbar ul a:focus, .sf-navbar ul a:hover, .sf-navbar ul a:active {
background: #D1DFFF;
}
ul.sf-navbar li li li:hover,
ul.sf-navbar li li li.sfHover,
.sf-navbar li li.current li.current,
.sf-navbar ul li li a:focus, .sf-navbar ul li li a:hover, .sf-navbar ul li li a:active {
background: #E6EEFF;
}
ul.sf-navbar .current ul,
ul.sf-navbar ul li:hover ul,
ul.sf-navbar ul li.sfHover ul {
left: 0;
top: 2.5em; /* match top ul list item height */
}
ul.sf-navbar .current ul ul {
top: -999em;
}
.sf-navbar li li.current > a {
font-weight: bold;
}
/*** point all arrows down ***/
/* point right for anchors in subs */
.sf-navbar ul .sf-sub-indicator { background-position: -10px -100px; }
.sf-navbar ul a > .sf-sub-indicator { background-position: 0 -100px; }
/* apply hovers to modern browsers */
.sf-navbar ul a:focus > .sf-sub-indicator,
.sf-navbar ul a:hover > .sf-sub-indicator,
.sf-navbar ul a:active > .sf-sub-indicator,
.sf-navbar ul li:hover > a > .sf-sub-indicator,
.sf-navbar ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/*** remove shadow on first submenu ***/
.sf-navbar > li > ul {
background: transparent;
padding: 0;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-topright: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
}

View File

@ -1,23 +0,0 @@
/*** adding sf-vertical in addition to sf-menu creates a vertical menu ***/
.sf-vertical, .sf-vertical li {
width: 10em;
}
/* this lacks ul at the start of the selector, so the styles from the main CSS file override it where needed */
.sf-vertical li:hover ul,
.sf-vertical li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*** alter arrow directions ***/
.sf-vertical .sf-sub-indicator { background-position: -10px 0; } /* IE6 gets solid image only */
.sf-vertical a > .sf-sub-indicator { background-position: 0 0; } /* use translucent arrow for modern browsers*/
/* hover arrow direction for modern browsers*/
.sf-vertical a:focus > .sf-sub-indicator,
.sf-vertical a:hover > .sf-sub-indicator,
.sf-vertical a:active > .sf-sub-indicator,
.sf-vertical li:hover > a > .sf-sub-indicator,
.sf-vertical li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}

View File

@ -1,136 +0,0 @@
/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu {
line-height: 1.0;
}
.sf-menu ul {
position: absolute;
top: -999em;
width: 10em; /* left offset of submenus need to match (see below) */
}
.sf-menu ul li {
width: 100%;
}
.sf-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.sf-menu li {
float: left;
position: relative;
}
.sf-menu a {
display: block;
position: relative;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
top: 2.5em; /* match top ul list item height */
z-index: 99;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1em;
}
.sf-menu a {
border-left: 1px solid #fff;
border-top: 1px solid #CFDEFF;
padding: .75em 1em;
text-decoration:none;
}
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #13a;
}
.sf-menu li {
background: #BDD2FF;
}
.sf-menu li li {
background: #AABDE6;
}
.sf-menu li li li {
background: #9AAEDB;
}
.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
background: #CFDEFF;
outline: 0;
}
/*** arrows **/
.sf-menu a.sf-with-ul {
padding-right: 2.25em;
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
}
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.05em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: .8em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
/* apply hovers to modern browsers */
.sf-menu ul a:focus > .sf-sub-indicator,
.sf-menu ul a:hover > .sf-sub-indicator,
.sf-menu ul a:active > .sf-sub-indicator,
.sf-menu ul li:hover > a > .sf-sub-indicator,
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*** shadows for all but IE6 ***/
.sf-shadow ul {
background: url('../images/shadow.png') no-repeat bottom right;
padding: 0 8px 9px 0;
-moz-border-radius-bottomleft: 17px;
-moz-border-radius-topright: 17px;
-webkit-border-top-right-radius: 17px;
-webkit-border-bottom-left-radius: 17px;
}
.sf-shadow ul.sf-shadow-off {
background: transparent;
}

View File

@ -1,123 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>A very basic Superfish menu example</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen">
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="js/hoverIntent.js"></script>
<script type="text/javascript" src="js/superfish.js"></script>
<script type="text/javascript">
// initialise plugins
jQuery(function(){
jQuery('ul.sf-menu').superfish();
});
</script>
</head>
<body>
<ul class="sf-menu">
<li class="current">
<a href="#a">menu item</a>
<ul>
<li>
<a href="#aa">menu item that is quite long</a>
</li>
<li class="current">
<a href="#ab">menu item</a>
<ul>
<li class="current"><a href="#">menu item</a></li>
<li><a href="#aba">menu item</a></li>
<li><a href="#abb">menu item</a></li>
<li><a href="#abc">menu item</a></li>
<li><a href="#abd">menu item</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">menu item</a>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">short</a></li>
<li><a href="#">short</a></li>
<li><a href="#">short</a></li>
<li><a href="#">short</a></li>
<li><a href="#">short</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
<li>
<a href="#">menu item</a>
<ul>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
<li><a href="#">menu item</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">menu item</a>
</li>
</ul>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,84 +0,0 @@
(function($){
/* hoverIntent by Brian Cherne */
$.fn.hoverIntent = function(f,g) {
// default configuration options
var cfg = {
sensitivity: 7,
interval: 100,
timeout: 0
};
// override configuration options with user supplied object
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).unbind("mousemove",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
if ( p == this ) { return false; }
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = jQuery.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// else e.type == "onmouseover"
if (e.type == "mouseover") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).bind("mousemove",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "onmouseout"
} else {
// unbind expensive mousemove event
$(ob).unbind("mousemove",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// bind the function to the two event listeners
return this.mouseover(handleHover).mouseout(handleHover);
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -1,10 +0,0 @@
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
* $Rev: 2111 $
*
* Version 2.1
*/
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);

View File

@ -1,121 +0,0 @@
/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
;(function($){
$.fn.superfish = function(op){
var sf = $.fn.superfish,
c = sf.c,
$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
over = function(){
var $$ = $(this), menu = getMenu($$);
clearTimeout(menu.sfTimer);
$$.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(){
var $$ = $(this), menu = getMenu($$), o = sf.op;
clearTimeout(menu.sfTimer);
menu.sfTimer=setTimeout(function(){
o.retainPath=($.inArray($$[0],o.$path)>-1);
$$.hideSuperfishUl();
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
},o.delay);
},
getMenu = function($menu){
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
sf.op = sf.o[menu.serial];
return menu;
},
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
return this.each(function() {
var s = this.serial = sf.o.length;
var o = $.extend({},sf.defaults,op);
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
.filter('li:has(ul)').removeClass(o.pathClass);
});
sf.o[s] = sf.op = o;
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
if (o.autoArrows) addArrow( $('>a:first-child',this) );
})
.not('.'+c.bcClass)
.hideSuperfishUl();
var $a = $('a',this);
$a.each(function(i){
var $li = $a.eq(i).parents('li');
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
});
o.onInit.call(this);
}).each(function() {
var menuClasses = [c.menuClass];
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
$(this).addClass(menuClasses.join(' '));
});
};
var sf = $.fn.superfish;
sf.o = [];
sf.op = {};
sf.IE7fix = function(){
var o = sf.op;
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');
};
sf.c = {
bcClass : 'sf-breadcrumb',
menuClass : 'sf-js-enabled',
anchorClass : 'sf-with-ul',
arrowClass : 'sf-sub-indicator',
shadowClass : 'sf-shadow'
};
sf.defaults = {
hoverClass : 'sfHover',
pathClass : 'overideThisToUse',
pathLevels : 1,
delay : 800,
animation : {opacity:'show'},
speed : 'normal',
autoArrows : true,
dropShadows : true,
disableHI : false, // true disables hoverIntent detection
onInit : function(){}, // callback functions
onBeforeShow: function(){},
onShow : function(){},
onHide : function(){}
};
$.fn.extend({
hideSuperfishUl : function(){
var o = sf.op,
not = (o.retainPath===true) ? o.$path : '';
o.retainPath = false;
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
.find('>ul').hide().css('visibility','hidden');
o.onHide.call($ul);
return this;
},
showSuperfishUl : function(){
var o = sf.op,
sh = sf.c.shadowClass+'-off',
$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');
sf.IE7fix.call($ul);
o.onBeforeShow.call($ul);
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
return this;
}
});
})(jQuery);

View File

@ -1,90 +0,0 @@
/*
* Supersubs v0.2b - jQuery plugin
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*
* This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
* their longest list item children. If you use this, please expect bugs and report them
* to the jQuery Google Group with the word 'Superfish' in the subject line.
*
*/
;(function($){ // $ will refer to jQuery within this closure
$.fn.supersubs = function(options){
var opts = $.extend({}, $.fn.supersubs.defaults, options);
// return original object to support chaining
return this.each(function() {
// cache selections
var $$ = $(this);
// support metadata
var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
// get the font size of menu.
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
'padding' : 0,
'position' : 'absolute',
'top' : '-999em',
'width' : 'auto'
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
// remove em dash
$('#menu-fontsize').remove();
// cache all ul elements
$ULs = $$.find('ul');
// loop through each ul in menu
$ULs.each(function(i) {
// cache this ul
var $ul = $ULs.eq(i);
// get all (li) children of this ul
var $LIs = $ul.children();
// get all anchor grand-children
var $As = $LIs.children('a');
// force content to one line and save current float property
var liFloat = $LIs.css('white-space','nowrap').css('float');
// remove width restrictions and floats so elements remain vertically stacked
var emWidth = $ul.add($LIs).add($As).css({
'float' : 'none',
'width' : 'auto'
})
// this ul will now be shrink-wrapped to longest li due to position:absolute
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
.end().end()[0].clientWidth / fontsize;
// add more width to ensure lines don't turn over at certain sizes in various browsers
emWidth += o.extraWidth;
// restrict to at least minWidth and at most maxWidth
if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
emWidth += 'em';
// set ul to width in ems
$ul.css('width',emWidth);
// restore li floats to avoid IE bugs
// set li width to full width of this ul
// revert white-space to normal
$LIs.css({
'float' : liFloat,
'width' : '100%',
'white-space' : 'normal'
})
// update offset position of descendant ul to reflect new width of parent
.each(function(){
var $childUl = $('>ul',this);
var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
$childUl.css(offsetDirection,emWidth);
});
});
});
};
// expose defaults
$.fn.supersubs.defaults = {
minWidth : 9, // requires em unit.
maxWidth : 25, // requires em unit.
extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
};
})(jQuery); // plugin code ends

View File

@ -0,0 +1,148 @@
.text-core {
position: relative;
}
.text-core .text-wrap {
background: #fff;
position: absolute;
}
.text-core .text-wrap textarea, .text-core .text-wrap input {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
outline: none;
resize: none;
position: absolute;
background: none;
overflow: hidden;
margin: 0;
padding: 3px 5px 4px 5px;
white-space: nowrap;
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;
line-height: 13px;
height: auto;
}
.text-core .text-wrap .text-arrow {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
top: 0;
right: 0;
width: 22px;
height: 22px;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAOAQMAAADHWqTrAAAAA3NCSVQICAjb4U/gAAAABlBMVEX///8yXJnt8Ns4AAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1MzmNZGAwAAABpJREFUCJljYEAF/xsY6hkY7BgYZBgYOFBkADkdAmFDagYFAAAAAElFTkSuQmCC") 50% 50% no-repeat;
cursor: pointer;
z-index: 2;
}
.text-core .text-wrap .text-dropdown {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
position: absolute;
z-index: 3;
background: #fff;
border: 1px solid #9daccc;
width: 100%;
max-height: 100px;
padding: 1px;
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;
display: none;
overflow-x: hidden;
overflow-y: auto;
}
.text-core .text-wrap .text-dropdown.text-position-below {
margin-top: 1px;
}
.text-core .text-wrap .text-dropdown.text-position-above {
margin-bottom: 1px;
}
.text-core .text-wrap .text-dropdown .text-list .text-suggestion {
padding: 3px 5px;
cursor: pointer;
}
.text-core .text-wrap .text-dropdown .text-list .text-suggestion.text-selected {
color: #fff;
background: #6d84b4;
}
.text-core .text-wrap .text-focus {
-webkit-box-shadow: 0px 0px 6px #6d84b4;
-moz-box-shadow: 0px 0px 6px #6d84b4;
box-shadow: 0px 0px 6px #6d84b4;
position: absolute;
width: 100%;
height: 100%;
display: none;
}
.text-core .text-wrap .text-focus.text-show-focus {
display: block;
}
.text-core .text-wrap .text-prompt {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
width: 100%;
height: 100%;
margin: 1px 0 0 2px;
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;
color: #c0c0c0;
overflow: hidden;
white-space: pre;
}
.text-core .text-wrap .text-prompt.text-hide-prompt {
display: none;
}
.text-core .text-wrap .text-tags {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
width: 100%;
height: 100%;
padding: 3px 35px 3px 3px;
cursor: text;
}
.text-core .text-wrap .text-tags.text-tags-on-top {
z-index: 2;
}
.text-core .text-wrap .text-tags .text-tag {
float: left;
}
.text-core .text-wrap .text-tags .text-tag .text-button {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
float: left;
border: 1px solid #9daccc;
background: #e2e6f0;
color: #000;
padding: 0px 17px 0px 3px;
margin: 0 2px 2px 0;
cursor: pointer;
height: 16px;
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;
}
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove {
position: absolute;
right: 3px;
top: 2px;
display: block;
width: 11px;
height: 11px;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAhCAYAAAAPm1F2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAB50RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNS4xqx9I6wAAAQ5JREFUOI2dlD0WwiAQhCc8L6HHgAPoASwtSYvX8BrQxtIyveYA8RppLO1jE+LwE8lzms2yH8MCj1QoaBzH+VuUYNYMS213UlvDRamtUbXb5ZyPHuDoxwGgip3ipfvGuGzPz+vZ/coDONdzFuYCO6ramQQG0DJIE1oPBBvM6e9LqaS2FwD7FWwnVoIAsOc2Xn1jDlyd8pfPBRVOBHA8cc/3yCmQqt0jcY4LuTyAF3pOYS6wI48LAm4MUrx5JthgSQJAt5LtNgAUgEMBBIC3AL2xgo58dEPfhE9wygef89FtCeC49UwltR1pQrK2qr9vNr7uRTCBF3pOYS6wI4/zdQ8MUpxPI9hgSQL0Xyio/QBt54DzsHQx6gAAAABJRU5ErkJggg==") 0 0 no-repeat;
}
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove:hover {
background-position: 0 -11px;
}
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove:active {
background-position: 0 -22px;
}

View File

@ -2465,7 +2465,7 @@
target = $(e.target)
;
if(target.is(CSS_DOT_SUGGESTION) || target.is(CSS_DOT_LABEL))
if($(CSS_DOT_SUGGESTION).has(target[0]) || $(CSS_DOT_LABEL).has(target[0]))
self.trigger('enterKeyPress');
if (self.core().hasPlugin('tags'))
@ -4774,157 +4774,3 @@
return node;
};
})(jQuery);
;(function(a){var b=document,c="getElementsByTagName",d=b[c]("head")[0]||b[c]("body")[0],e=b.createElement("style");e.innerHTML=a,d.appendChild(e)})('\n.text-core {\
position: relative;\
}\
.text-core .text-wrap {\
background: #fff;\
position: absolute;\
}\
.text-core .text-wrap textarea, .text-core .text-wrap input {\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
-webkit-border-radius: 0px;\
-moz-border-radius: 0px;\
border-radius: 0px;\
border: 1px solid #9daccc;\
outline: none;\
resize: none;\
position: absolute;\
z-index: 1;\
background: none;\
overflow: hidden;\
margin: 0;\
padding: 3px 5px 4px 5px;\
white-space: nowrap;\
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;\
line-height: 13px;\
height: auto;\
}\
\n.text-core .text-wrap .text-arrow {\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
position: absolute;\
top: 0;\
right: 0;\
width: 22px;\
height: 22px;\
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAOAQMAAADHWqTrAAAAA3NCSVQICAjb4U/gAAAABlBMVEX///8yXJnt8Ns4AAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1MzmNZGAwAAABpJREFUCJljYEAF/xsY6hkY7BgYZBgYOFBkADkdAmFDagYFAAAAAElFTkSuQmCC") 50% 50% no-repeat;\
cursor: pointer;\
z-index: 2;\
}\
\n.text-core .text-wrap .text-dropdown {\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
padding: 0;\
position: absolute;\
z-index: 3;\
background: #fff;\
border: 1px solid #9daccc;\
width: 100%;\
max-height: 100px;\
padding: 1px;\
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;\
display: none;\
overflow-x: hidden;\
overflow-y: auto;\
}\
.text-core .text-wrap .text-dropdown.text-position-below {\
margin-top: 1px;\
}\
.text-core .text-wrap .text-dropdown.text-position-above {\
margin-bottom: 1px;\
}\
.text-core .text-wrap .text-dropdown .text-list .text-suggestion {\
padding: 3px 5px;\
cursor: pointer;\
}\
.text-core .text-wrap .text-dropdown .text-list .text-suggestion em {\
font-style: normal;\
text-decoration: underline;\
}\
.text-core .text-wrap .text-dropdown .text-list .text-suggestion.text-selected {\
color: #fff;\
background: #6d84b4;\
}\
\n.text-core .text-wrap .text-focus {\
-webkit-box-shadow: 0px 0px 6px #6d84b4;\
-moz-box-shadow: 0px 0px 6px #6d84b4;\
box-shadow: 0px 0px 6px #6d84b4;\
position: absolute;\
width: 100%;\
height: 100%;\
display: none;\
}\
.text-core .text-wrap .text-focus.text-show-focus {\
display: block;\
}\
\n.text-core .text-wrap .text-prompt {\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
position: absolute;\
width: 100%;\
height: 100%;\
margin: 1px 0 0 2px;\
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;\
color: #c0c0c0;\
overflow: hidden;\
white-space: pre;\
}\
.text-core .text-wrap .text-prompt.text-hide-prompt {\
display: none;\
}\
\n.text-core .text-wrap .text-tags {\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
position: absolute;\
width: 100%;\
height: 100%;\
padding: 3px 35px 3px 3px;\
cursor: text;\
}\
.text-core .text-wrap .text-tags.text-tags-on-top {\
z-index: 2;\
}\
.text-core .text-wrap .text-tags .text-tag {\
float: left;\
}\
.text-core .text-wrap .text-tags .text-tag .text-button {\
-webkit-border-radius: 2px;\
-moz-border-radius: 2px;\
border-radius: 2px;\
-webkit-box-sizing: border-box;\
-moz-box-sizing: border-box;\
box-sizing: border-box;\
position: relative;\
float: left;\
border: 1px solid #9daccc;\
background: #e2e6f0;\
color: #000;\
padding: 0px 17px 0px 3px;\
margin: 0 2px 2px 0;\
cursor: pointer;\
height: 16px;\
font: 11px "lucida grande", tahoma, verdana, arial, sans-serif;\
}\
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove {\
position: absolute;\
right: 3px;\
top: 2px;\
display: block;\
width: 11px;\
height: 11px;\
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAhCAYAAAAPm1F2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAB50RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNS4xqx9I6wAAAQ5JREFUOI2dlD0WwiAQhCc8L6HHgAPoASwtSYvX8BrQxtIyveYA8RppLO1jE+LwE8lzms2yH8MCj1QoaBzH+VuUYNYMS213UlvDRamtUbXb5ZyPHuDoxwGgip3ipfvGuGzPz+vZ/coDONdzFuYCO6ramQQG0DJIE1oPBBvM6e9LqaS2FwD7FWwnVoIAsOc2Xn1jDlyd8pfPBRVOBHA8cc/3yCmQqt0jcY4LuTyAF3pOYS6wI48LAm4MUrx5JthgSQJAt5LtNgAUgEMBBIC3AL2xgo58dEPfhE9wygef89FtCeC49UwltR1pQrK2qr9vNr7uRTCBF3pOYS6wI4/zdQ8MUpxPI9hgSQL0Xyio/QBt54DzsHQx6gAAAABJRU5ErkJggg==") 0 0 no-repeat;\
}\
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove:hover {\
background-position: 0 -11px;\
}\
.text-core .text-wrap .text-tags .text-tag .text-button a.text-remove:active {\
background-position: 0 -22px;\
}\
');

View File

@ -0,0 +1,165 @@
/**
* Timeago is a jQuery plugin that makes it easy to support automatically
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
*
* Please note that the library has been slightly modified for i18n's sake.
*
* @name timeago
* @version 0.11.3
* @requires jQuery v1.2.3+
* @author Ryan McGeary
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
* For usage and examples, visit:
* http://timeago.yarp.com/
*
* Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
*/
(function($) {
$.timeago = function(timestamp) {
if (timestamp instanceof Date) {
return inWords(timestamp);
} else if (typeof timestamp === "string") {
return inWords($.timeago.parse(timestamp));
} else if (typeof timestamp === "number") {
return inWords(new Date(timestamp));
} else {
return inWords($.timeago.datetime(timestamp));
}
};
var $t = $.timeago;
$.extend($.timeago, {
settings: {
refreshMillis: 60000,
allowFuture: false,
strings: {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "ago",
suffixFromNow: "from now",
seconds: "less than a minute",
minute: "about a minute",
minutes: "%d minutes",
hour: "about an hour",
hours: "about %d hours",
day: "a day",
days: "%d days",
month: "about a month",
months: "%d months",
year: "about a year",
years: "%d years",
wordSeparator: " ",
numbers: []
},
translator: null
},
inWords: function(distanceMillis) {
var $l = this.settings.strings;
var prefix = $l.prefixAgo;
var suffix = $l.suffixAgo;
if (this.settings.allowFuture) {
if (distanceMillis < 0) {
prefix = $l.prefixFromNow;
suffix = $l.suffixFromNow;
}
}
var seconds = Math.abs(distanceMillis) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
var years = days / 365;
function convert(stringOrFunction, number) {
var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
// return the proper string and the numeric value that goes in it
return {'string': string, 'value': ($l.numbers && $l.numbers[number]) || number};
}
var stringAndNumber = seconds < 45 && convert($l.seconds, Math.round(seconds)) ||
seconds < 90 && convert($l.minute, 1) ||
minutes < 45 && convert($l.minutes, Math.round(minutes)) ||
minutes < 90 && convert($l.hour, 1) ||
hours < 24 && convert($l.hours, Math.round(hours)) ||
hours < 42 && convert($l.day, 1) ||
days < 30 && convert($l.days, Math.round(days)) ||
days < 45 && convert($l.month, 1) ||
days < 365 && convert($l.months, Math.round(days / 30)) ||
years < 1.5 && convert($l.year, 1) ||
convert($l.years, Math.round(years));
var string = stringAndNumber.string;
var value = stringAndNumber.value;
var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator;
// compose and translate the final string
var fullString = $.trim([prefix, string, suffix].join(separator));
var translatedString = $t.settings.translator ?
$t.settings.translator(fullString) :
fullString;
return translatedString.replace(/%d/i, value);
},
parse: function(iso8601) {
var s = $.trim(iso8601);
s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
return new Date(s);
},
datetime: function(elem) {
var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
return $t.parse(iso8601);
},
isTime: function(elem) {
// jQuery's `is()` doesn't play well with HTML5 in IE
return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
}
});
$.fn.timeago = function() {
var self = this;
self.each(refresh);
var $s = $t.settings;
if ($s.refreshMillis > 0) {
setInterval(function() { self.each(refresh); }, $s.refreshMillis);
}
return self;
};
function refresh() {
var data = prepareData(this);
if (!isNaN(data.datetime)) {
$(this).text(inWords(data.datetime));
}
return this;
}
function prepareData(element) {
element = $(element);
if (!element.data("timeago")) {
element.data("timeago", { datetime: $t.datetime(element) });
var text = $.trim(element.text());
if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
element.attr("title", text);
}
}
return element.data("timeago");
}
function inWords(date) {
return $t.inWords(distance(date));
}
function distance(date) {
return (new Date().getTime() - date.getTime());
}
// fix for IE6 suckage
document.createElement("abbr");
document.createElement("time");
}(jQuery));

View File

@ -824,7 +824,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
background:whiteSmoke;
border-bottom:1px solid #ddd;
padding-bottom:0px;
color:#00438A;
color:#4c4c4c;
}
@ -861,7 +861,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
border: 1px solid #ddd;
border-bottom-color: #ffffff;
cursor: default;
color:gray;
color:#4c4c4c;
outline:none;
}

View File

@ -913,7 +913,7 @@ $.fn.extend({
tmp_args = arguments;
if (typeof(o) == 'string'){
if(o == 'getDate')
if(o == 'getDate' || o == 'widget')
return $.fn.datepicker.apply($(this[0]), tmp_args);
else
return this.each(function() {

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*!
* jQuery JavaScript Library v1.7.2b1
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
@ -11,7 +11,7 @@
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Tue Jan 31 20:11:27 2012 -0500
* Date: Wed Mar 21 12:46:34 2012 -0700
*/
(function( window, undefined ) {
@ -210,7 +210,7 @@ jQuery.fn = jQuery.prototype = {
selector: "",
// The current version of jQuery being used
jquery: "1.7.2b1",
jquery: "1.7.2",
// The default length of a jQuery object is 0
length: 0,
@ -578,6 +578,9 @@ jQuery.extend({
// Cross-browser xml parsing
parseXML: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
@ -1362,7 +1365,6 @@ jQuery.support = (function() {
select,
opt,
input,
marginDiv,
fragment,
tds,
events,
@ -1449,6 +1451,9 @@ jQuery.support = (function() {
pixelMargin: true
};
// jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
@ -1483,6 +1488,10 @@ jQuery.support = (function() {
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
@ -1497,23 +1506,6 @@ jQuery.support = (function() {
fragment.removeChild( input );
fragment.appendChild( div );
div.innerHTML = "";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
@ -1539,12 +1531,13 @@ jQuery.support = (function() {
fragment.removeChild( div );
// Null elements to avoid leaks in IE
fragment = select = opt = marginDiv = div = input = null;
fragment = select = opt = div = input = null;
// Run tests that need a body at doc ready
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
conMarginTop, ptlm, vb, style, html,
marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
paddingMarginBorderVisibility, paddingMarginBorder,
body = document.getElementsByTagName("body")[0];
if ( !body ) {
@ -1553,15 +1546,16 @@ jQuery.support = (function() {
}
conMarginTop = 1;
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
vb = "visibility:hidden;border:0;";
style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
html = "<div " + style + "><div></div></div>" +
"<table " + style + " cellpadding='0' cellspacing='0'>" +
paddingMarginBorder = "padding:0;margin:0;border:";
positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
"<table " + style + "' cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
container = document.createElement("div");
container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct the test element
@ -1575,8 +1569,7 @@ jQuery.support = (function() {
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
isSupported = ( tds[ 0 ].offsetHeight === 0 );
@ -1587,28 +1580,44 @@ jQuery.support = (function() {
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Figure out if the W3C box model works as expected
div.innerHTML = "";
div.style.width = div.style.paddingLeft = "1px";
jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
div.innerHTML = "";
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.width = div.style.padding = "1px";
div.style.border = 0;
div.style.overflow = "hidden";
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div style='width:5px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
}
div.style.cssText = ptlm + vb;
div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
div.innerHTML = html;
outer = div.firstChild;
@ -1643,7 +1652,7 @@ jQuery.support = (function() {
}
body.removeChild( container );
div = container = null;
marginDiv = div = container = null;
jQuery.extend( support, offsetSupport );
});
@ -1987,7 +1996,7 @@ function dataAttr( elem, key, data ) {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? parseFloat( data ) :
jQuery.isNumeric( data ) ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
@ -2196,7 +2205,7 @@ jQuery.fn.extend({
}
}
resolve();
return defer.promise();
return defer.promise( object );
}
});
@ -2365,7 +2374,7 @@ jQuery.fn.extend({
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
@ -2409,7 +2418,7 @@ jQuery.fn.extend({
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
@ -2555,7 +2564,7 @@ jQuery.extend({
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, l,
var propName, attrNames, name, l, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
@ -2567,13 +2576,17 @@ jQuery.extend({
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
jQuery.attr( elem, name, "" );
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && propName in elem ) {
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
@ -2727,7 +2740,8 @@ if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true
id: true,
coords: true
};
// Use this for any attribute in IE6/7
@ -3246,6 +3260,7 @@ jQuery.event = {
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [],
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
@ -3253,6 +3268,11 @@ jQuery.event = {
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
@ -3262,7 +3282,7 @@ jQuery.event = {
jqcur.context = this.ownerDocument || this;
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process events on disabled elements (#6911, #8165)
if ( cur.disabled !== true ) {
selMatch = {};
@ -3322,6 +3342,11 @@ jQuery.event = {
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
@ -3613,16 +3638,23 @@ if ( !jQuery.support.submitBubbles ) {
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
event._submit_bubble = true;
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
@ -5565,7 +5597,7 @@ jQuery.each({
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
@ -5709,7 +5741,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
@ -6036,6 +6068,8 @@ jQuery.fn.extend({
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
type: "GET",
global: false,
url: elem.src,
async: false,
dataType: "script"
@ -6141,12 +6175,16 @@ function cloneFixAttributes( src, dest ) {
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
// Clear flags for bubbling special change/submit events, they must
// be reattached when the newly cloned events are first activated
dest.removeAttribute( "_submit_attached" );
@ -6275,7 +6313,7 @@ jQuery.extend({
destElements,
i,
// IE<=8 does not properly clone detached, unknown element nodes
clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
elem.cloneNode( true ) :
shimCloneNode( elem );
@ -6325,7 +6363,8 @@ jQuery.extend({
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
var checkScriptType, script, j,
ret = [];
context = context || document;
@ -6334,8 +6373,6 @@ jQuery.extend({
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
@ -6357,7 +6394,9 @@ jQuery.extend({
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
div = context.createElement("div"),
safeChildNodes = safeFragment.childNodes,
remove;
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
@ -6402,6 +6441,21 @@ jQuery.extend({
}
elem = div.childNodes;
// Clear elements from DocumentFragment (safeFragment or otherwise)
// to avoid hoarding elements. Fixes #11356
if ( div ) {
div.parentNode.removeChild( div );
// Guard against -1 index exceptions in FF3.6
if ( safeChildNodes.length > 0 ) {
remove = safeChildNodes[ safeChildNodes.length - 1 ];
if ( remove && remove.parentNode ) {
remove.parentNode.removeChild( remove );
}
}
}
}
}
@ -6430,16 +6484,17 @@ jQuery.extend({
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
script = ret[i];
if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
if ( script.nodeType === 1 ) {
var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
fragment.appendChild( script );
}
}
}
@ -6659,7 +6714,7 @@ jQuery.extend({
}
});
// DEPRECATED, Use jQuery.css() instead
// DEPRECATED in 1.3, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
if ( document.defaultView && document.defaultView.getComputedStyle ) {
@ -7228,7 +7283,7 @@ jQuery.extend({
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
@ -7927,8 +7982,7 @@ jQuery.ajaxSetup({
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
@ -8229,7 +8283,13 @@ if ( jQuery.support.ajax ) {
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
responses.text = xhr.responseText;
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( _ ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
@ -8456,7 +8516,7 @@ jQuery.fn.extend({
prop[ name ] = prop[ p ];
delete prop[ p ];
}
if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
replace = hooks.expand( prop[ name ] );
delete prop[ name ];
@ -8699,11 +8759,11 @@ jQuery.extend({
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
linear: function( p ) {
return p;
},
swing: function( p, n, firstNum, diff ) {
return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
swing: function( p ) {
return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
}
},
@ -8933,12 +8993,14 @@ jQuery.extend( jQuery.fx, {
}
});
// Adds width/height step functions
// Do not set anything below 0
jQuery.each([ "width", "height" ], function( i, prop ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
// Ensure props that can't be negative don't go there on undershoot easing
jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
// exclude marginTop, marginLeft, marginBottom and marginRight from this list
if ( prop.indexOf( "margin" ) ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
@ -8975,7 +9037,7 @@ function defaultDisplay( nodeName ) {
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
@ -9279,7 +9341,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
doc = elem.document;
docElemProp = doc.documentElement[ clientProp ];
return doc.compatMode === "CSS1Compat" && docElemProp ||
return jQuery.support.boxModel && docElemProp ||
doc.body && doc.body[ clientProp ] || docElemProp;
}
@ -9287,8 +9349,16 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc = elem.documentElement;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
// so we can't use max, as it'll choose the incorrect offset[Width/Height]
// instead we use the correct client[Width/Height]
// support:IE6
if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
return doc[ clientProp ];
}
return Math.max(
doc[ clientProp ],
elem.body[ scrollProp ], doc[ scrollProp ],
elem.body[ offsetProp ], doc[ offsetProp ]
);

View File

@ -1,480 +0,0 @@
/*
http://www.JSON.org/json2.js
2011-02-23
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or '&nbsp;'),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, strict: false, regexp: false */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
"use strict";
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z' : null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0 ? '[]' : gap ?
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0 ? '{}' : gap ?
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
'{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());

View File

@ -1,514 +0,0 @@
/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
v2.0.3 (c) Kyle Simpson
MIT License
*/
(function(global){
var _$LAB = global.$LAB,
// constants for the valid keys of the options object
_UseLocalXHR = "UseLocalXHR",
_AlwaysPreserveOrder = "AlwaysPreserveOrder",
_AllowDuplicates = "AllowDuplicates",
_CacheBust = "CacheBust",
/*!START_DEBUG*/_Debug = "Debug",/*!END_DEBUG*/
_BasePath = "BasePath",
// stateless variables used across all $LAB instances
root_page = /^[^?#]*\//.exec(location.href)[0],
root_domain = /^\w+\:\/\/\/?[^\/]+/.exec(root_page)[0],
append_to = document.head || document.getElementsByTagName("head"),
// inferences... ick, but still necessary
opera_or_gecko = (global.opera && Object.prototype.toString.call(global.opera) == "[object Opera]") || ("MozAppearance" in document.documentElement.style),
/*!START_DEBUG*/
// console.log() and console.error() wrappers
log_msg = function(){},
log_error = log_msg,
/*!END_DEBUG*/
// feature sniffs (yay!)
test_script_elem = document.createElement("script"),
explicit_preloading = typeof test_script_elem.preload == "boolean", // http://wiki.whatwg.org/wiki/Script_Execution_Control#Proposal_1_.28Nicholas_Zakas.29
real_preloading = explicit_preloading || (test_script_elem.readyState && test_script_elem.readyState == "uninitialized"), // will a script preload with `src` set before DOM append?
script_ordered_async = !real_preloading && test_script_elem.async === true, // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
// XHR preloading (same-domain) and cache-preloading (remote-domain) are the fallbacks (for some browsers)
xhr_or_cache_preloading = !real_preloading && !script_ordered_async && !opera_or_gecko
;
/*!START_DEBUG*/
// define console wrapper functions if applicable
if (global.console && global.console.log) {
if (!global.console.error) global.console.error = global.console.log;
log_msg = function(msg) { global.console.log(msg); };
log_error = function(msg,err) { global.console.error(msg,err); };
}
/*!END_DEBUG*/
// test for function
function is_func(func) { return Object.prototype.toString.call(func) == "[object Function]"; }
// test for array
function is_array(arr) { return Object.prototype.toString.call(arr) == "[object Array]"; }
// make script URL absolute/canonical
function canonical_uri(src,base_path) {
var absolute_regex = /^\w+\:\/\//;
// is `src` is protocol-relative (begins with // or ///), prepend protocol
if (/^\/\/\/?/.test(src)) {
src = location.protocol + src;
}
// is `src` page-relative? (not an absolute URL, and not a domain-relative path, beginning with /)
else if (!absolute_regex.test(src) && src.charAt(0) != "/") {
// prepend `base_path`, if any
src = (base_path || "") + src;
}
// make sure to return `src` as absolute
return absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src);
}
// merge `source` into `target`
function merge_objs(source,target) {
for (var k in source) { if (source.hasOwnProperty(k)) {
target[k] = source[k]; // TODO: does this need to be recursive for our purposes?
}}
return target;
}
// does the chain group have any ready-to-execute scripts?
function check_chain_group_scripts_ready(chain_group) {
var any_scripts_ready = false;
for (var i=0; i<chain_group.scripts.length; i++) {
if (chain_group.scripts[i].ready && chain_group.scripts[i].exec_trigger) {
any_scripts_ready = true;
chain_group.scripts[i].exec_trigger();
chain_group.scripts[i].exec_trigger = null;
}
}
return any_scripts_ready;
}
// creates a script load listener
function create_script_load_listener(elem,registry_item,flag,onload) {
elem.onload = elem.onreadystatechange = function() {
if ((elem.readyState && elem.readyState != "complete" && elem.readyState != "loaded") || registry_item[flag]) return;
elem.onload = elem.onreadystatechange = null;
onload();
};
}
// script executed handler
function script_executed(registry_item) {
registry_item.ready = registry_item.finished = true;
for (var i=0; i<registry_item.finished_listeners.length; i++) {
registry_item.finished_listeners[i]();
}
registry_item.ready_listeners = [];
registry_item.finished_listeners = [];
}
// make the request for a scriptha
function request_script(chain_opts,script_obj,registry_item,onload,preload_this_script) {
// setTimeout() "yielding" prevents some weird race/crash conditions in older browsers
setTimeout(function(){
var script, src = script_obj.real_src, xhr;
// don't proceed until `append_to` is ready to append to
if ("item" in append_to) { // check if `append_to` ref is still a live node list
if (!append_to[0]) { // `append_to` node not yet ready
// try again in a little bit -- note: will re-call the anonymous function in the outer setTimeout, not the parent `request_script()`
setTimeout(arguments.callee,25);
return;
}
// reassign from live node list ref to pure node ref -- avoids nasty IE bug where changes to DOM invalidate live node lists
append_to = append_to[0];
}
script = document.createElement("script");
if (script_obj.type) script.type = script_obj.type;
if (script_obj.charset) script.charset = script_obj.charset;
// should preloading be used for this script?
if (preload_this_script) {
// real script preloading?
if (real_preloading) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload: "+src);/*!END_DEBUG*/
registry_item.elem = script;
if (explicit_preloading) { // explicit preloading (aka, Zakas' proposal)
script.preload = true;
script.onpreload = onload;
}
else {
script.onreadystatechange = function(){
if (script.readyState == "loaded") onload();
};
}
script.src = src;
// NOTE: no append to DOM yet, appending will happen when ready to execute
}
// same-domain and XHR allowed? use XHR preloading
else if (preload_this_script && src.indexOf(root_domain) == 0 && chain_opts[_UseLocalXHR]) {
xhr = new XMLHttpRequest(); // note: IE never uses XHR (it supports true preloading), so no more need for ActiveXObject fallback for IE <= 7
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload (xhr): "+src);/*!END_DEBUG*/
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
xhr.onreadystatechange = function(){}; // fix a memory leak in IE
registry_item.text = xhr.responseText + "\n//@ sourceURL=" + src; // http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
onload();
}
};
xhr.open("GET",src);
xhr.send();
}
// as a last resort, use cache-preloading
else {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script preload (cache): "+src);/*!END_DEBUG*/
script.type = "text/cache-script";
create_script_load_listener(script,registry_item,"ready",function() {
append_to.removeChild(script);
onload();
});
script.src = src;
append_to.insertBefore(script,append_to.firstChild);
}
}
// use async=false for ordered async? parallel-load-serial-execute http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
else if (script_ordered_async) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script load (ordered async): "+src);/*!END_DEBUG*/
script.async = false;
create_script_load_listener(script,registry_item,"finished",onload);
script.src = src;
append_to.insertBefore(script,append_to.firstChild);
}
// otherwise, just a normal script element
else {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("start script load: "+src);/*!END_DEBUG*/
create_script_load_listener(script,registry_item,"finished",onload);
script.src = src;
append_to.insertBefore(script,append_to.firstChild);
}
},0);
}
// create a clean instance of $LAB
function create_sandbox() {
var global_defaults = {},
can_use_preloading = real_preloading || xhr_or_cache_preloading,
queue = [],
registry = {},
instanceAPI
;
// global defaults
global_defaults[_UseLocalXHR] = true;
global_defaults[_AlwaysPreserveOrder] = false;
global_defaults[_AllowDuplicates] = false;
global_defaults[_CacheBust] = false;
/*!START_DEBUG*/global_defaults[_Debug] = false;/*!END_DEBUG*/
global_defaults[_BasePath] = "";
// execute a script that has been preloaded already
function execute_preloaded_script(chain_opts,script_obj,registry_item) {
var script;
function preload_execute_finished() {
if (script != null) { // make sure this only ever fires once
script = null;
script_executed(registry_item);
}
}
if (registry[script_obj.src].finished) return;
if (!chain_opts[_AllowDuplicates]) registry[script_obj.src].finished = true;
script = registry_item.elem || document.createElement("script");
if (script_obj.type) script.type = script_obj.type;
if (script_obj.charset) script.charset = script_obj.charset;
create_script_load_listener(script,registry_item,"finished",preload_execute_finished);
// script elem was real-preloaded
if (registry_item.elem) {
registry_item.elem = null;
}
// script was XHR preloaded
else if (registry_item.text) {
script.onload = script.onreadystatechange = null; // script injection doesn't fire these events
script.text = registry_item.text;
}
// script was cache-preloaded
else {
script.src = script_obj.real_src;
}
append_to.insertBefore(script,append_to.firstChild);
// manually fire execution callback for injected scripts, since events don't fire
if (registry_item.text) {
preload_execute_finished();
}
}
// process the script request setup
function do_script(chain_opts,script_obj,chain_group,preload_this_script) {
var registry_item,
registry_items,
ready_cb = function(){ script_obj.ready_cb(script_obj,function(){ execute_preloaded_script(chain_opts,script_obj,registry_item); }); },
finished_cb = function(){ script_obj.finished_cb(script_obj,chain_group); }
;
script_obj.src = canonical_uri(script_obj.src,chain_opts[_BasePath]);
script_obj.real_src = script_obj.src +
// append cache-bust param to URL?
(chain_opts[_CacheBust] ? ((/\?.*$/.test(script_obj.src) ? "&_" : "?_") + ~~(Math.random()*1E9) + "=") : "")
;
if (!registry[script_obj.src]) registry[script_obj.src] = {items:[],finished:false};
registry_items = registry[script_obj.src].items;
// allowing duplicates, or is this the first recorded load of this script?
if (chain_opts[_AllowDuplicates] || registry_items.length == 0) {
registry_item = registry_items[registry_items.length] = {
ready:false,
finished:false,
ready_listeners:[ready_cb],
finished_listeners:[finished_cb]
};
request_script(chain_opts,script_obj,registry_item,
// which callback type to pass?
(
(preload_this_script) ? // depends on script-preloading
function(){
registry_item.ready = true;
for (var i=0; i<registry_item.ready_listeners.length; i++) {
registry_item.ready_listeners[i]();
}
registry_item.ready_listeners = [];
} :
function(){ script_executed(registry_item); }
),
// signal if script-preloading should be used or not
preload_this_script
);
}
else {
registry_item = registry_items[0];
if (registry_item.finished) {
finished_cb();
}
else {
registry_item.finished_listeners.push(finished_cb);
}
}
}
// creates a closure for each separate chain spawned from this $LAB instance, to keep state cleanly separated between chains
function create_chain() {
var chainedAPI,
chain_opts = merge_objs(global_defaults,{}),
chain = [],
exec_cursor = 0,
scripts_currently_loading = false,
group
;
// called when a script has finished preloading
function chain_script_ready(script_obj,exec_trigger) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("script preload finished: "+script_obj.real_src);/*!END_DEBUG*/
script_obj.ready = true;
script_obj.exec_trigger = exec_trigger;
advance_exec_cursor(); // will only check for 'ready' scripts to be executed
}
// called when a script has finished executing
function chain_script_executed(script_obj,chain_group) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("script execution finished: "+script_obj.real_src);/*!END_DEBUG*/
script_obj.ready = script_obj.finished = true;
script_obj.exec_trigger = null;
// check if chain group is all finished
for (var i=0; i<chain_group.scripts.length; i++) {
if (!chain_group.scripts[i].finished) return;
}
// chain_group is all finished if we get this far
chain_group.finished = true;
advance_exec_cursor();
}
// main driver for executing each part of the chain
function advance_exec_cursor() {
while (exec_cursor < chain.length) {
if (is_func(chain[exec_cursor])) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg("$LAB.wait() executing: "+chain[exec_cursor]);/*!END_DEBUG*/
try { chain[exec_cursor++](); } catch (err) {
/*!START_DEBUG*/if (chain_opts[_Debug]) log_error("$LAB.wait() error caught: ",err);/*!END_DEBUG*/
}
continue;
}
else if (!chain[exec_cursor].finished) {
if (check_chain_group_scripts_ready(chain[exec_cursor])) continue;
break;
}
exec_cursor++;
}
// we've reached the end of the chain (so far)
if (exec_cursor == chain.length) {
scripts_currently_loading = false;
group = false;
}
}
// setup next chain script group
function init_script_chain_group() {
if (!group || !group.scripts) {
chain.push(group = {scripts:[],finished:true});
}
}
// API for $LAB chains
chainedAPI = {
// start loading one or more scripts
script:function(){
for (var i=0; i<arguments.length; i++) {
(function(script_obj,script_list){
var splice_args;
if (!is_array(script_obj)) {
script_list = [script_obj];
}
for (var j=0; j<script_list.length; j++) {
init_script_chain_group();
script_obj = script_list[j];
if (is_func(script_obj)) script_obj = script_obj();
if (!script_obj) continue;
if (is_array(script_obj)) {
// set up an array of arguments to pass to splice()
splice_args = [].slice.call(script_obj); // first include the actual array elements we want to splice in
splice_args.unshift(j,1); // next, put the `index` and `howMany` parameters onto the beginning of the splice-arguments array
[].splice.apply(script_list,splice_args); // use the splice-arguments array as arguments for splice()
j--; // adjust `j` to account for the loop's subsequent `j++`, so that the next loop iteration uses the same `j` index value
continue;
}
if (typeof script_obj == "string") script_obj = {src:script_obj};
script_obj = merge_objs(script_obj,{
ready:false,
ready_cb:chain_script_ready,
finished:false,
finished_cb:chain_script_executed
});
group.finished = false;
group.scripts.push(script_obj);
do_script(chain_opts,script_obj,group,(can_use_preloading && scripts_currently_loading));
scripts_currently_loading = true;
if (chain_opts[_AlwaysPreserveOrder]) chainedAPI.wait();
}
})(arguments[i],arguments[i]);
}
return chainedAPI;
},
// force LABjs to pause in execution at this point in the chain, until the execution thus far finishes, before proceeding
wait:function(){
if (arguments.length > 0) {
for (var i=0; i<arguments.length; i++) {
chain.push(arguments[i]);
}
group = chain[chain.length-1];
}
else group = false;
advance_exec_cursor();
return chainedAPI;
}
};
// the first chain link API (includes `setOptions` only this first time)
return {
script:chainedAPI.script,
wait:chainedAPI.wait,
setOptions:function(opts){
merge_objs(opts,chain_opts);
return chainedAPI;
}
};
}
// API for each initial $LAB instance (before chaining starts)
instanceAPI = {
// main API functions
setGlobalDefaults:function(opts){
merge_objs(opts,global_defaults);
return instanceAPI;
},
setOptions:function(){
return create_chain().setOptions.apply(null,arguments);
},
script:function(){
return create_chain().script.apply(null,arguments);
},
wait:function(){
return create_chain().wait.apply(null,arguments);
},
// built-in queuing for $LAB `script()` and `wait()` calls
// useful for building up a chain programmatically across various script locations, and simulating
// execution of the chain
queueScript:function(){
queue[queue.length] = {type:"script", args:[].slice.call(arguments)};
return instanceAPI;
},
queueWait:function(){
queue[queue.length] = {type:"wait", args:[].slice.call(arguments)};
return instanceAPI;
},
runQueue:function(){
var $L = instanceAPI, len=queue.length, i=len, val;
for (;--i>=0;) {
val = queue.shift();
$L = $L[val.type].apply(null,val.args);
}
return $L;
},
// rollback `[global].$LAB` to what it was before this file was loaded, the return this current instance of $LAB
noConflict:function(){
global.$LAB = _$LAB;
return instanceAPI;
},
// create another clean instance of $LAB
sandbox:function(){
return create_sandbox();
}
};
return instanceAPI;
}
// create the main instance of $LAB
global.$LAB = create_sandbox();
/* The following "hack" was suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?).
The hack essentially "patches" the **page** that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does
proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked
document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready.
For instance, jQuery 1.4+ has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or
fixed by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs.
*/
(function(addEvent,domLoaded,handler){
if (document.readyState == null && document[addEvent]){
document.readyState = "loading";
document[addEvent](domLoaded,handler = function(){
document.removeEventListener(domLoaded,handler,false);
document.readyState = "complete";
},false);
}
})("addEventListener","DOMContentLoaded");
})(this);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,999 +0,0 @@
.openerp {
padding: 0;
margin: 0;
font-size: 80%;
font-family: Ubuntu, Helvetica, sans-serif;
}
.openerp, .openerp textarea, .openerp input, .openerp select, .openerp option,
.openerp button, .openerp .ui-widget {
font-family: Ubuntu, Helvetica, sans-serif;
font-size:85%;
}
.openerp .view-manager-main-content {
width: 100%;
}
.openerp .oe_form_group_cell .view-manager-main-content {
padding: 0;
}
.oe_box {
border: 1px solid #aaf;
padding: 2px;
margin: 2px;
}
#oe_errors pre {
margin: 0;
}
.openerp .oe-listview .oe-number {
text-align: right !important;
}
.oe-listview-header-columns {
background: #d1d1d1; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #d1d1d1 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#d1d1d1)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#d1d1d1 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#d1d1d1 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#d1d1d1 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#d1d1d1',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #ffffff 0%,#d1d1d1 100%); /* W3C */
}
.openerp .oe_hide {
display: none !important;
}
/* STATES */
.openerp .on_logged,
.openerp .db_options_row {
display: none;
}
/* Database */
.login .oe-database-manager {
display: none;
height: 100%;
width: 100%;
background-color: white;
}
.login.database_block .bottom,
.login.database_block .login_error_message,
.login.database_block .pane {
display: none;
}
.login.database_block .oe-database-manager {
display: block;
}
.login .database {
float: left;
width: 202px;
height: 100%;
background: #666666;
}
.login .oe_db_options {
margin-left: 202px;
color: black;
padding-top: 20px;
}
.login .database ul {
margin-top: 65px;
}
ul.db_options li {
padding: 5px 0 10px 5px;
background: #949292; /* Old browsers */
background: -moz-linear-gradient(top, #949292 30%, #6d6b6b 95%, #282828 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(30%,#949292), color-stop(95%,#6d6b6b), color-stop(100%,#282828)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #949292 30%,#6d6b6b 95%,#282828 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #949292 30%,#6d6b6b 95%,#282828 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #949292 30%,#6d6b6b 95%,#282828 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#949292', endColorstr='#282828',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #949292 30%,#6d6b6b 95%,#282828 100%); /* W3C */
/* for ie9 */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#949292', endColorstr='#5B5A5A',GradientType=0 ); /* IE6-9 */
border: none;
/* overriding jquery ui */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
display: block;
font-weight: bold;
text-transform: uppercase;
margin: 1px;
color: #EEEEEE;
cursor: pointer;
width: 195px;
font-size: 12px;
}
.db_option_table {
border: 1px solid #5A5858;
padding: 5px;
-moz-border-radius: 10px;
}
table.db_option_table input.required {
background-color: #D2D2FF !important;
}
.db_option_table label {
display: block;
text-align: right;
}
.db_option_table input[type="text"],
.db_option_table input[type="password"],
.db_option_table input[type="file"],
.db_option_table select {
width: 300px;
}
.option_string {
font-weight: bold;
color: #555;
width: 100%;
text-align: center;
padding: 10px 0;
font-size: large;
}
label.error {
float: none;
color: red;
padding-left: .5em;
vertical-align: top;
}
/* Main*/
.openerp .main_table {
width: 100%;
height: 100%;
background: #f0eeee;
}
.openerp .oe-application {
height: 100%;
}
.openerp .oe-application-container {
width: 100%;
height: 100%;
}
/* IE Hack - for IE < 9
* Avoids footer to be placed statically at 100% cutting the middle of the views
* */
.openerp .oe-application-container {
height: auto\9;
min-height: 100%\9;
}
/* Main Application */
.openerp .oe-main-content {
padding: 0;
height: 100%;
}
.openerp h2.oe_view_title {
font-size: 110%;
font-weight: normal;
margin: 2px 0;
color: #252424;
text-shadow: white 0 1px 0;
}
.openerp div[id^="notebook"] .oe_view_title {
font-size:85%;
padding-bottom:4px;
}
/* List */
.openerp table.oe-listview-content {
clear: right;
width: 100%;
border-spacing: 0;
border: 1px solid silver;
}
.openerp .oe-listview thead table {
width: 100%;
border: none;
}
.openerp .oe-listview tr.odd {
background-color: #f3f3f3;
}
.openerp .oe-listview tbody tr:hover {
background-color: #ecebf2;
}
.openerp .oe-listview tbody tr:hover {
background-color: #eae9f0;
}
.openerp .oe-listview thead table tr,
.openerp .oe-listview thead table tr:hover {
background: none;
}
.openerp .oe-listview > table > tbody > tr > td,
.openerp .oe-listview th {
vertical-align: middle;
text-align: left;
padding: 1px 2px;
}
.openerp .oe-record-delete button,
.openerp button.oe-edit-row-save {
border: none;
height: 12px;
width: 12px;
background: url("/web/static/src/img/iconset-b-remove.png") no-repeat scroll center center transparent;
cursor: pointer;
}
.openerp button.oe-edit-row-save {
background-image: url('/web/static/src/img/icons/save-document.png');
}
/* Could use :not selectors if they were supported by MSIE8... */
.openerp .oe-listview > table > tbody > tr > td {
border-left: 1px solid #dadada; /*currently commenting to test with no vertical lines in list view*/
}
.openerp .oe-listview tbody td:first-child,
.openerp .oe-listview tbody td.oe-button,
.openerp .oe-listview tbody td.oe-button,
.openerp .oe-listview tbody th.oe-record-selector,
.openerp .oe-listview tbody td.oe-record-delete {
border-left: none;
}
.openerp .oe-listview td.oe-record-delete {
text-align: right;
}
.openerp .oe-listview th.oe-sortable {
cursor: pointer;
font-size: 75%;
text-transform: uppercase;
padding: 0;
margin: 0;
padding-left: 3px;
color: #333;
}
.openerp .oe-listview th.oe-sortable .ui-icon {
height: 60%;
margin: -6px 0 0;
display: inline;
display: inline-block;
vertical-align: middle;
}
.openerp .oe-listview > table > tbody > tr > td {
border-bottom: 1px solid #E3E3E3;
}
.openerp .oe-listview td.oe-actions {
border-bottom:none;
}
.openerp .oe-listview .oe-record-selector, .openerp .oe-listview .oe-record-edit-link {
border-bottom: 1px solid #E3E3E3;
}
.openerp .oe-listview .oe-record-edit-link {
cursor: pointer;
}
.openerp .oe-listview .oe-field-cell {
cursor: pointer;
margin-top: 0;
margin-bottom: 0;
padding-top: 3px;
padding-bottom: 3px;
font-size: 80%;
}
.openerp .oe-listview .oe-field-cell progress {
width: 100%;
}
.openerp .oe-listview .oe-field-cell.oe-button button,
.openerp .oe-listview .oe_form_button button {
margin: 0;
padding: 0;
border: none;
background: none;
width: 16px;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
}
.openerp .oe-listview .oe-field-cell button:active {
opacity: 0.5;
}
.openerp .oe-listview .oe-field-cell button img {
cursor: pointer;
}
.openerp .oe-listview .oe-field-cell button img:hover {
opacity: 0.75;
}
.openerp .oe-listview .oe-field-cell .oe-listview-button-disabled img {
opacity: 0.5;
}
.openerp .oe-listview th.oe-actions {
text-align: left;
white-space: nowrap;
}
.openerp .oe-listview th.oe-list-pager {
text-align: right;
white-space: nowrap;
}
.openerp .oe-list-pager .oe-pager-state {
cursor: pointer;
font-size: 90%;
color: #555;
}
.openerp .oe_button.oe_button_pager,
.openerp .oe-list-pager > span,
.openerp .oe_form_pager > span {
line-height: 17px;
height: 17px;
cursor: pointer;
color: gray;
font-weight: bold;
vertical-align: middle;
}
.openerp .oe_button.oe_button_pager,
.openerp .oe_button.oe_button_pager:disabled {
padding: 0 3px 0 3px;
margin: 0;
height: 17px;
}
.openerp .oe-listview .oe-group-name {
padding-right: 1em;
}
.openerp .oe-listview .oe-group-name,
.openerp .oe-listview .oe-group-pagination {
white-space: nowrap;
}
.openerp .oe-listview tfoot td {
padding: 3px 3px 0;
}
.openerp .oe-listview .oe-list-footer {
text-align: center;
white-space: nowrap;
color: #444;
font-size: 85%;
}
.openerp .oe-listview .oe-list-footer span {
margin: 0 1em;
}
.openerp .oe-listview .oe-list-footer progress {
vertical-align:-10% !important;
width: 100%;
}
/** list rounded corners
rounded corners are a pain on tables: need to round not only table, but
also on the first and last children of the first and last row
*/
.openerp .oe-listview table.oe-listview-content {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.openerp .oe-listview table.oe-listview-content thead tr:first-child th:first-child {
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
}
.openerp .oe-listview table.oe-listview-content thead tr:first-child th:last-child {
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
}
.openerp .oe-listview table.oe-listview-content tfoot tr:last-child th:first-child,
.openerp .oe-listview table.oe-listview-content tfoot tr:last-child td:first-child,
.openerp .oe-listview table.oe-listview-content tbody:last-child tr:last-child th:first-child {
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
.openerp .oe-listview table.oe-listview-content tfoot tr:last-child th:last-child,
.openerp .oe-listview table.oe-listview-content tfoot tr:last-child td:last-child,
.openerp .oe-listview table.oe-listview-content tbody:last-child tr:last-child td:last-child {
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
}
/* Form */
.openerp .oe_form_group_cell input[type="checkbox"] {
margin-top: 3px;
vertical-align: middle;
}
.openerp .oe_form_group_cell .input[type="text"] {
padding-bottom: 1px;
}
.openerp table.oe_form_group td {
color: #4c4c4c;
}
.openerp table.oe_form_group {
color: #4c4c4c;
}
.openerp fieldset.oe_group_box {
border: 1px solid #AAAAAA;
moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background: #F9F9F9;
padding: 4px;
}
.openerp fieldset.oe_group_box legend {
font-weight: bold;
}
.openerp .required.error {
border: 1px solid #900;
}
.openerp .oe_form_buttons, .openerp .oe_list_buttons {
float: left;
}
.openerp .oe_form_pager, .openerp .oe_list_pager {
float: right;
font-size: 80%;
color: gray;
font-weight: bold;
}
.openerp .oe_form_pager {
margin-right: 3px;
}
.openerp .oe_align_left {
text-align: left;
}
.openerp .oe_align_right {
text-align: right;
}
.openerp .oe_align_center {
text-align: center;
}
.openerp .oe_form .oe_form_paragraph {
margin: 3px 0 0 0;
white-space: normal;
}
.openerp .oe_form .oe_form_paragraph.oe_multilines {
white-space: pre;
}
.openerp .oe_form_field_one2many .oe-actions h3.oe_view_title,
.openerp .oe_form_field_one2many_list .oe-actions h3.oe_view_title{
display: inline;
margin: 0 0.5em 0 0;
}
.openerp .oe_form .oe-listview th.oe-sortable .ui-icon,
.openerp .oe_form .oe-listview th.oe-sortable .ui-icon {
height: 100%;
margin-top: -9px;
}
.openerp table.oe_form_group .oe-listview-content td {
color: inherit;
}
/* Uneditable Form View */
.openerp .oe_form_readonly {
}
.openerp .oe_form_readonly .oe_form_group_cell .field_text,
.openerp .oe_form_readonly .field_char,
.openerp .oe_form_readonly .field_int,
.openerp .oe_form_readonly .field_float,
.openerp .oe_form_readonly .field_email,
.openerp .oe_form_readonly .field_date,
.openerp .oe_form_readonly .field_selection,
.openerp .oe_form_readonly .oe_form_field_many2one {
padding: 3px 2px 2px 2px;
background-color: white;
height: 17px;
}
.openerp .oe_form_readonly .oe_form_group_cell .field_text {
height: auto;
}
.openerp .oe_form_readonly .field_datetime {
padding: 1px 2px 2px 2px;
background-color: white;
height:19px;
}
.openerp .oe_form_readonly .oe_form_field_many2one div {
background-color:white;
height:18px;
margin-bottom:1px;
padding: 0px 2px 5px 2px;
}
.openerp .oe_form_readonly .oe_form_field_email div {
background-color: white;
padding: 1px 2px 3px 2px;
}
.openerp .oe_form_readonly .oe_form_field_text div.field_text,
.openerp .oe_form_readonly .oe_form_field_text_html div.field_text_html {
white-space: pre-wrap;
}
.openerp .oe_form_readonly .oe_form_group_cell .field_text {
min-height:100px;
}
/* Inputs */
/* vertically recentering filter management select tag */
.openerp select.oe_search-view-filters-management {
margin-top:2px;
}
@-moz-document url-prefix() {
/* Strange firefox behaviour on width: 100% + white-space: nowrap */
.openerp .oe_form .oe_form_button .oe_button {
width: auto;
}
}
/* IE Hack - for IE < 9
* Avoids buttons overflow
* */
.openerp .oe_form .oe_form_button .oe_button {
min-width: auto\9;
}
/* jQuery UI override */
.openerp .ui-widget {
font-size: 1em;
}
.openerp tbody.ui-widget-content {
margin-bottom: 10px;
border-spacing: 4px;
}
.openerp .ui-widget-header {
background: white none;
}
/* Sidebar */
.openerp .view-manager-main-table {
margin: 0;
width:100%;
border-collapse:collapse;
height:100%;
}
.openerp .view-manager-main-table tbody {
vertical-align: top;
}
.openerp .oe-view-manager-header {
overflow: auto;
background: url("/web/static/src/img/sep-a.gif") 0 100% repeat-x;
margin:6px 0 6px 2px;
}
.openerp .oe_form_group_cell .oe-view-manager-header { /* Trick: remove the background when element is in a formular */
background: none;
}
.openerp .oe-view-manager-header h2 {
float: left;
}
.openerp .oe_view_manager_menu_tips blockquote {
display: none;
font-size: 85%;
margin: 0;
background: #fff;
border-bottom: 1px solid #CECBCB;
padding: 1px 10px;
color: #4C4C4C;
}
.openerp .oe_view_manager_menu_tips blockquote p {
margin: 0;
padding: 6px 1px 4px;
}
.openerp .oe_view_manager_menu_tips blockquote div {
text-align: right;
margin-right:10px;
}
.openerp .oe_view_manager_menu_tips blockquote div button {
border: none;
background: none;
padding: 0 4px;
margin: 0;
display: inline;
text-decoration: underline;
color: inherit;
}
.openerp .view-manager-main-sidebar {
width: 180px;
padding: 0;
margin: 0;
}
.openerp .sidebar-main-div {
height: 100%;
border-left: 1px solid #D2CFCF;
}
.openerp .sidebar-content {
padding: 0;
margin: 0;
width: 180px;
height: 100%;
font-size: 0.9em;
}
.openerp .closed-sidebar .sidebar-content {
width: 22px;
}
.openerp .closed-sidebar .sidebar-content {
display: none;
}
.openerp .sidebar-main-div a {
color: #555;
text-decoration: none;
}
.openerp .sidebar-main-div a:hover {
color: black;
}
.openerp .oe-sidebar-attachments-toolbar {
margin: 4px 0 0 4px;
}
.openerp .oe-sidebar-attachments-items {
clear: both;
padding-top: 5px !important;
}
.openerp .oe-sidebar-attachments-items li {
position: relative;
padding: 0 0 3px 10px !important;
}
.openerp .oe-sidebar-attachments-items li:hover {
background: #ddd;
}
.openerp .oe-sidebar-attachments-link {
display: block;
margin-right: 15px;
overflow: hidden;
}
.openerp .oe-sidebar-attachment-delete {
position: absolute;
right: 2px;
top: 1px;
overflow: hidden;
width: 15px;
height: 15px;
padding: 1px;
border-radius: 7px;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
.openerp .oe-sidebar-attachment-delete:hover {
background-color: white;
}
.openerp .view-manager-main-sidebar h2 {
margin:0;
font-size: 1.15em;
color: #8E8E8E;
text-shadow: white 0 1px 0;
padding-left: 10px;
padding-right: 21px;
height: 21px;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #ebe9e9 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#ebe9e9)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#EBE9E9',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
border: 1px solid #D2CFCF;
border-right-width: 0;
border-left-width: 0;
}
.openerp .view-manager-main-sidebar h2 {
border-top-width: 0;
}
.openerp .view-manager-main-sidebar ul {
list-style-type: none;
margin: 0;
padding: 0;
display: block;
}
.openerp .view-manager-main-sidebar li {
display: block;
padding: 3px 3px 3px 10px;
}
.openerp .toggle-sidebar {
cursor: pointer;
border: 1px solid #D2CFCF;
border-top-width: 0;
display: block;
background: url(/web/static/src/img/toggle-a-bg.png);
width: 21px;
height: 21px;
z-index: 10;
}
.openerp .open-sidebar .toggle-sidebar {
margin-left: 158px;
background-position: 21px 0;
position: absolute;
}
.openerp .closed-sidebar .toggle-sidebar {
border-left: none;
}
.openerp li.oe_sidebar_print {
padding-left: 20px;
background: 1px 3px url(/web/static/src/img/icons/gtk-print.png) no-repeat;
}
.openerp .oe_sidebar_print ul {
padding-left:8px;
}
.openerp.kitten-mode-activated .main_table {
background: url(http://placekitten.com/g/1500/800) repeat;
}
.openerp.kitten-mode-activated.clark-gable .main_table {
background: url(http://amigrave.com/ClarkGable.jpg);
background-size: 100%;
}
.openerp.kitten-mode-activated .header {
background: url(http://placekitten.com/g/211/65) repeat;
}
.openerp.kitten-mode-activated .menu {
background: #828282;
background: -moz-linear-gradient(top, #828282 0%, #4D4D4D 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#828282), color-stop(100%,#4D4D4D));
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#828282', endColorstr='#4D4D4D',GradientType=0 );
}
.openerp.kitten-mode-activated .menu a {
background: none;
}
.openerp.kitten-mode-activated .menu span {
background: none;
}
.openerp.kitten-mode-activated .sidebar-content li a,
.openerp.kitten-mode-activated .oe-application .view-manager-main-content h2.oe_view_title,
.openerp.kitten-mode-activated .oe-application .view-manager-main-content a.searchview_group_string,
.openerp.kitten-mode-activated .oe-application .view-manager-main-content label {
color: white;
}
.openerp.kitten-mode-activated .menu,
.openerp.kitten-mode-activated .header_corner,
.openerp.kitten-mode-activated .header_title,
.openerp.kitten-mode-activated .oe-application,
.openerp.kitten-mode-activated .oe_footer,
.openerp.kitten-mode-activated .loading,
.openerp.kitten-mode-activated .ui-dialog {
opacity:0.8;
filter:alpha(opacity=80);
}
.openerp.kitten-mode-activated .header .company_logo {
background: url(http://placekitten.com/g/180/46);
}
.openerp.kitten-mode-activated .loading {
background: #828282;
border-color: #828282;
}
.openerp .oe-m2o-drop-down-button {
margin-left: -24px;
}
.openerp .oe-m2o-drop-down-button img {
margin-bottom: -4px;
cursor: pointer;
}
.openerp .oe-m2o input {
border-right: none;
margin-right: 0px !important;
padding-bottom: 2px !important;
}
.openerp .oe-m2o-disabled-cm {
color: grey;
}
.openerp ul[role="listbox"] li a {
font-size:80%;
}
.parent_top {
vertical-align: text-top;
}
.openerp .oe-dialog-warning p {
padding-left: 1em;
font-size: 1.2em;
font-weight: bold;
}
.openerp .dhx_mini_calendar {
-moz-box-shadow: none;
-khtml-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.openerp .oe-treeview-table {
width: 100%;
background-color : #FFFFFF;
border-spacing: 0;
}
.openerp .oe-treeview-table tr:hover{
color: blue;
background-color : #D8D8D8;
}
.treeview-tr, .treeview-td {
cursor: pointer;
vertical-align: top;
text-align: left;
border-bottom: 1px solid #CFCCCC;
}
.openerp .oe-treeview-table .oe-number {
text-align: right !important;
}
.treeview-tr span, .treeview-td span {
font-size: 90%;
font-weight: normal;
white-space: nowrap;
display: block;
}
.treeview-tr.oe-treeview-first {
background: transparent url(/web/static/src/img/expand.gif) 0 50% no-repeat;
}
.oe-open .treeview-tr.oe-treeview-first {
background-image: url(/web/static/src/img/collapse.gif);
}
.treeview-tr.oe-treeview-first span,
.treeview-td.oe-treeview-first span {
margin-left: 16px;
}
.treeview-header {
vertical-align: top;
background-color : #D8D8D8;
white-space: nowrap;
text-align: left;
padding: 4px 5px;
}
ul.oe-arrow-list {
padding-left: 1.1em;
margin: 0;
white-space: nowrap;
}
ul.oe-arrow-list li {
display: inline-block;
margin-left: -1em;
}
ul.oe-arrow-list li span {
vertical-align: top;
display: inline-block;
border: 1em solid #DEDEDE;
line-height:0em;
}
ul.oe-arrow-list .oe-arrow-list-before {
border-left-color: rgba(0,0,0,0);
border-right-width:0;
}
ul.oe-arrow-list .oe-arrow-list-after {
border-color: rgba(0,0,0,0);
border-left-color: #DEDEDE;
border-right-width:0;
}
ul.oe-arrow-list li.oe-arrow-list-selected span {
border-color: #B5B9FF;
}
ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-before {
border-left-color: rgba(0,0,0,0);
}
ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after {
border-color: rgba(0,0,0,0);
border-left-color: #B5B9FF;
}
.openerp ul.oe-arrow-list li:first-child span:first-child{
-webkit-border-top-left-radius: 3px;
-moz-border-radius-topleft: 3px;
border-top-left-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-moz-border-radius-bottomleft: 3px;
border-bottom-left-radius: 3px;
}
.openerp ul.oe-arrow-list li:last-child span:last-child{
-webkit-border-top-right-radius: 3px;
-moz-border-radius-topright: 3px;
border-top-right-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
-moz-border-radius-bottomright: 3px;
border-bottom-right-radius: 3px;
}
.openerp .oe_view_editor {
width:100%;
border-collapse : collapse;
margin-left: -12px;
width: 100%;
background-color : white;
border-spacing: 0;
}
.openerp .oe_view_editor td{
text-align: center;
white-space: nowrap;
border: 1px solid #D8D8D8;
cursor: pointer;
font-size: 90%;
}
.openerp .oe_view_editor_field td{
border: 0px !important;
}
.openerp .oe_view_editor tr:hover {
background-color: #ecebf2;
}
/* Dialog traceback cases */
.openerp .oe_error_detail{
display: block;
}
.openerp .oe_error_send{
display:block;
}
.openerp .oe_fielddiv{
display:inline-block;
width:100%;
}
.openerp .oe_fielddiv input[type=text],textarea{
width:100%;
}
/* for Alignment center */
.openerp .oe_centeralign{
text-align:center;
}
.openerp .oe_applications_tiles {
color: #4C4C4C;
text-shadow: #EEE 0 1px 0;
margin: 0 20px;
}
.openerp select.oe_search-view-filters-management {
font-style: oblique;
color: #999999;
}
.openerp .oe_search-view-filters-management option,
.openerp .oe_search-view-filters-management optgroup {
font-style: normal;
color: black;
}
/* Internet Explorer Fix */
a img {
border: none;
}

View File

@ -1,4 +1,4 @@
.openerp .oe-export {
.openerp .oe_export {
width: 100%;
}
.openerp .oe_export_row tr{

View File

@ -12,22 +12,22 @@
border-bottom: 1px solid #E3E3E3;
}
.openerp .oe-import-no-result .oe-import-result {
.openerp .oe_import_no_result .oe_import_result {
display: none;
}
.openerp .oe-import fieldset {
.openerp .oe_import fieldset {
cursor: pointer;
}
.openerp .oe-import fieldset legend:before {
.openerp .oe_import fieldset legend:before {
content: '\25BC ';
}
.openerp .oe-import fieldset.oe-closed legend:before {
.openerp .oe_import fieldset.oe_closed legend:before {
content: '\25B6 ';
}
.openerp .oe-import fieldset.oe-closed table {
.openerp .oe_import fieldset.oe_closed table {
display: none;
}
.openerp .oe-import .separator.horizontal {
.openerp .oe_import .separator.horizontal {
font-weight: bold;
border-bottom-width: 1px;
margin: 6px 4px 6px 1px;

View File

@ -24,7 +24,7 @@
init: function(modules) {
// By default only web will be loaded, the rest will be by loaded
// by openerp.web.Session on the first session_authenticate
modules = modules || ["web"];
modules = _.union(['web'], modules || []);
var new_instance = {
// links to the global openerp
_openerp: openerp,

View File

@ -63,7 +63,7 @@ instance.web.Dialog = instance.web.Widget.extend({
this.dialog_options = {
modal: true,
destroy_on_close: true,
width: $(window).width() * (($(window).width() > 1024) ? 0.5 : 0.75),
width: 900,
min_width: 0,
max_width: '95%',
height: 'auto',
@ -136,14 +136,18 @@ instance.web.Dialog = instance.web.Widget.extend({
},
on_close: function() {
if (this.dialog_options.destroy_on_close) {
this.$element.dialog('destroy');
this.destroy();
}
},
on_resized: function() {
},
destroy: function () {
this.close();
this.$element.dialog('destroy');
_.each(this.getChildren(), function(el) {
el.destroy();
});
if (! this.isDestroyed()) {
this.$element.dialog('destroy');
}
this._super();
}
});
@ -206,7 +210,14 @@ instance.web.CrashManager = instance.web.CallbackEnabled.extend({
buttons: buttons
}).open();
dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.connection, error: error}));
}
},
on_javascript_exception: function(exception) {
this.on_traceback({
type: _t("Client Error"),
message: exception,
data: {debug: ""}
});
},
});
instance.web.Loading = instance.web.Widget.extend({
@ -394,7 +405,14 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
success: function () {
self.do_notify(_t("Backed"), _t("Database backed up successfully"));
},
error: instance.webclient.crashmanager.on_rpc_error,
error: function(error){
if(error){
self.display_error({
title: 'Backup Database',
error: 'AccessDenied'
});
}
},
complete: function() {
self.unblockUI();
}
@ -464,24 +482,26 @@ instance.web.Login = instance.web.Widget.extend({
}
}
},
open_db_manager: function(){
var self = this;
self.$element.find('.oe_login_bottom').hide();
self.$element.find('.oe_login_pane').hide();
self.databasemanager = new instance.web.DatabaseManager(self);
self.databasemanager.appendTo(self.$element);
self.databasemanager.do_exit.add_last(function() {
self.databasemanager.destroy();
self.$element.find('.oe_login_bottom').show();
self.$element.find('.oe_login_pane').show();
self.load_db_list(true).then(self.on_db_list_loaded);
});
},
start: function() {
var self = this;
self.$element.find("form").submit(self.on_submit);
self.$element.find('.oe_login_manage_db').click(function() {
self.$element.find('.oe_login_bottom').hide();
self.$element.find('.oe_login_pane').hide();
self.databasemanager = new instance.web.DatabaseManager(self);
self.databasemanager.appendTo(self.$element);
self.databasemanager.do_exit.add_last(function() {
self.databasemanager.destroy();
self.$element.find('.oe_login_bottom').show();
self.$element.find('.oe_login_pane').show();
self.load_db_list(true).then(self.proxy('_db_list_loaded'));
});
self.open_db_manager();
});
return self.load_db_list().then(self.proxy('_db_list_loaded'));
return self.load_db_list().then(self.on_db_list_loaded);
},
load_db_list: function (force) {
var d = $.when(), self = this;
@ -496,11 +516,14 @@ instance.web.Login = instance.web.Widget.extend({
}
return d;
},
_db_list_loaded: function () {
var list = this._db_list,
dbdiv = this.$element.find('div.oe_login_dbpane');
on_db_list_loaded: function () {
var self = this;
var list = this._db_list;
var dbdiv = this.$element.find('div.oe_login_dbpane');
this.$element.find("[name=db]").replaceWith(instance.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db}));
if(list && list.length === 1) {
if(list.length === 0) {
self.open_db_manager();
} else if(list && list.length === 1) {
dbdiv.hide();
} else {
dbdiv.show();
@ -531,6 +554,7 @@ instance.web.Login = instance.web.Widget.extend({
do_login: function (db, login, password) {
var self = this;
this.$element.removeClass('oe_login_invalid');
self.$(".oe_login_pane").fadeOut("slow");
return this.session.session_authenticate(db, login, password).pipe(function() {
if (self.has_local_storage) {
if(self.remember_credentials) {
@ -545,9 +569,9 @@ instance.web.Login = instance.web.Widget.extend({
localStorage.setItem('last_password_login_success', '');
}
}
self.$(".oe_login_pane").fadeOut("slow");
self.trigger("login");
},function () {
self.$(".oe_login_pane").fadeIn("fast");
self.$element.addClass("oe_login_invalid");
});
}
@ -564,6 +588,7 @@ instance.web.Menu = instance.web.Widget.extend({
start: function() {
this._super.apply(this, arguments);
this.$secondary_menus = this.getParent().$element.find('.oe_secondary_menus_container');
this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click);
return this.do_reload();
},
do_reload: function() {
@ -575,12 +600,7 @@ instance.web.Menu = instance.web.Widget.extend({
this.renderElement();
this.limit_entries();
this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this }));
this.$element.on('click', 'a.oe_menu_more_link', function() {
self.$element.find('.oe_menu_more').toggle();
return false;
});
this.$element.on('click', 'a[data-menu]', this.on_menu_click);
this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click);
// Hide second level submenus
this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide();
if (self.current_menu) {
@ -599,16 +619,12 @@ instance.web.Menu = instance.web.Widget.extend({
$index.after($more);
$more.find('.oe_menu_more').append($index.next().nextAll());
}
this.do_hide_more();
},
auto_limit_entries: function() {
// TODO: auto detect overflow and bind window on resize
var width = $(window).width();
return Math.floor(width / 125);
},
do_hide_more: function() {
this.$element.find('.oe_menu_more').hide();
},
/**
* Opens a given menu by id, as if a user had browsed to that menu by hand
* except does not trigger any event on the way
@ -656,7 +672,7 @@ instance.web.Menu = instance.web.Widget.extend({
* @param {Number} id the action_id to match
*/
open_action: function (id) {
var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id=' + id + ']');
var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]');
var menu_id = $menu.data('menu');
if (menu_id) {
this.open_menu(menu_id);
@ -666,33 +682,37 @@ instance.web.Menu = instance.web.Widget.extend({
* Process a click on a menu item
*
* @param {Number} id the menu_id
* @param {Boolean} [needaction=false] whether the triggered action should execute in a `needs action` context
*/
menu_click: function(id) {
if (id) {
this.do_hide_more();
// find back the menuitem in dom to get the action
var $item = this.$element.find('a[data-menu=' + id + ']');
if (!$item.length) {
$item = this.$secondary_menus.find('a[data-menu=' + id + ']');
}
var action_id = $item.data('action-id');
// If first level menu doesnt have action trigger first leaf
if (!action_id) {
if(this.$element.has($item).length) {
$sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');
$items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');
if($items.length) {
action_id = $items.data('action-id');
id = $items.data('menu');
}
menu_click: function(id, needaction) {
if (!id) { return; }
// find back the menuitem in dom to get the action
var $item = this.$element.find('a[data-menu=' + id + ']');
if (!$item.length) {
$item = this.$secondary_menus.find('a[data-menu=' + id + ']');
}
var action_id = $item.data('action-id');
// If first level menu doesnt have action trigger first leaf
if (!action_id) {
if(this.$element.has($item).length) {
var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');
var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');
if($items.length) {
action_id = $items.data('action-id');
id = $items.data('menu');
}
}
this.open_menu(id);
this.current_menu = id;
this.session.active_id = id;
if (action_id) {
this.trigger('menu_click', action_id, id, $item);
}
}
this.open_menu(id);
this.current_menu = id;
this.session.active_id = id;
if (action_id) {
this.trigger('menu_click', {
action_id: action_id,
needaction: needaction,
id: id
}, $item);
}
},
/**
@ -701,9 +721,9 @@ instance.web.Menu = instance.web.Widget.extend({
* @param {Event} ev the jquery event
*/
on_menu_click: function(ev) {
this.menu_click($(ev.currentTarget).data('menu'));
ev.stopPropagation();
return false;
ev.preventDefault();
var needaction = $(ev.target).is('div.oe_menu_counter');
this.menu_click($(ev.currentTarget).data('menu'), needaction);
},
});
@ -716,20 +736,12 @@ instance.web.UserMenu = instance.web.Widget.extend({
start: function() {
var self = this;
this._super.apply(this, arguments);
$('html').bind('click', function() {
self.$element.find('.oe_dropdown_options').hide();
});
this.$element.find('.oe_dropdown_toggle').click(function() {
self.$element.find('.oe_dropdown_options').toggle();
return false;
});
this.$element.on('click', '.oe_dropdown_options li a[data-menu]', function() {
this.$element.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) {
ev.preventDefault();
var f = self['on_menu_' + $(this).data('menu')];
if (f) {
f($(this));
}
self.$element.find('.oe_dropdown_options').hide();
return false;
});
},
change_password :function() {
@ -815,8 +827,8 @@ instance.web.UserMenu = instance.web.Widget.extend({
{text: _t("Change password"), click: function(){ self.change_password(); }},
{text: _t("Cancel"), click: function(){ $(this).dialog('destroy'); }},
{text: _t("Save"), click: function(){
var inner_viewmanager = action_manager.inner_viewmanager;
inner_viewmanager.views[inner_viewmanager.active_view].controller.do_save()
var inner_widget = action_manager.inner_widget;
inner_widget.views[inner_widget.active_view].controller.do_save()
.then(function() {
self.dialog.destroy();
// needs to refresh interface in case language changed
@ -844,40 +856,94 @@ instance.web.UserMenu = instance.web.Widget.extend({
},
});
instance.web.WebClient = instance.web.Widget.extend({
init: function(parent) {
var self = this;
instance.web.Client = instance.web.Widget.extend({
init: function(parent, origin) {
instance.client = instance.webclient = this;
this._super(parent);
instance.webclient = this;
this.querystring = '?' + jQuery.param.querystring();
this._current_state = null;
this.origin = origin;
},
start: function() {
var self = this;
this.$element.addClass("openerp openerp-web-client-container");
if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
$("body").addClass("kitten-mode-activated");
self.$element.delegate('img.oe-record-edit-link-img', 'hover', function(e) {
self.$element.toggleClass('clark-gable');
});
}
this.session.session_bind().then(function() {
self.destroy_content();
return instance.connection.session_bind(this.origin).then(function() {
var $e = $(QWeb.render(self._template, {}));
self.$element.replaceWith($e);
self.$element = $e;
self.bind_events();
self.show_common();
if (!self.session.session_is_valid()) {
self.show_login();
} else {
self.show_application();
}
});
},
bind_events: function() {
var self = this;
this.$element.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() {
$(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter');
});
this.$element.on('click', '.oe_dropdown_toggle', function(ev) {
ev.preventDefault();
var $toggle = $(this);
var $menu = $toggle.find('.oe_dropdown_menu');
var state = $menu.is('.oe_opened');
setTimeout(function() {
// Do not alter propagation
$toggle.add($menu).toggleClass('oe_opened', !state);
if (!state) {
// Move $menu if outside window's edge
var doc_width = $(document).width();
var offset = $menu.offset();
var menu_width = $menu.width();
var x = doc_width - offset.left - menu_width - 15;
if (x < 0) {
$menu.offset({ left: offset.left + x }).width(menu_width);
}
}
}, 0);
});
instance.web.bus.on('click', this, function() {
self.$element.find('.oe_dropdown_menu.oe_opened').removeClass('oe_opened');
});
},
show_common: function() {
var self = this;
this.crashmanager = new instance.web.CrashManager();
instance.connection.on_rpc_error.add(this.crashmanager.on_rpc_error);
self.notification = new instance.web.Notification(this);
self.notification.appendTo(self.$element);
self.loading = new instance.web.Loading(self);
self.loading.appendTo(self.$element);
self.action_manager = new instance.web.ActionManager(self);
self.action_manager.appendTo(self.$('.oe_application'));
},
});
instance.web.WebClient = instance.web.Client.extend({
_template: 'WebClient',
init: function(parent) {
this._super(parent);
this._current_state = null;
},
start: function() {
var self = this;
return $.when(this._super()).pipe(function() {
if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
$("body").addClass("kitten-mode-activated");
if ($.blockUI) {
$.blockUI.defaults.message = '<img src="http://www.amigrave.com/kitten.gif">';
}
}
if (!self.session.session_is_valid()) {
self.show_login();
} else {
self.show_application();
}
});
},
set_title: function(title) {
title = _.str.clean(title);
var sep = _.isEmpty(title) ? '' : ' - ';
document.title = title + sep + 'OpenERP';
},
show_common: function() {
var self = this;
this._super();
window.onerror = function (message, file, line) {
self.crashmanager.on_traceback({
type: _t("Client Error"),
@ -885,15 +951,9 @@ instance.web.WebClient = instance.web.Widget.extend({
data: {debug: file + ':' + line}
});
};
self.notification = new instance.web.Notification(this);
self.notification.appendTo(self.$element);
self.loading = new instance.web.Loading(self);
self.loading.appendTo(self.$element);
// TODO: deprecate and use login client action
self.login = new instance.web.Login(self);
self.login.on("login",self,self.show_application);
self.$table = $(QWeb.render("WebClient", {}));
self.action_manager = new instance.web.ActionManager(self);
self.action_manager.appendTo(self.$table.find('.oe_application'));
},
show_login: function() {
var self = this;
@ -901,7 +961,6 @@ instance.web.WebClient = instance.web.Widget.extend({
},
show_application: function() {
var self = this;
self.$element.append(self.$table);
self.login.$element.hide();
self.menu = new instance.web.Menu(self);
self.menu.replace(this.$element.find('.oe_menu_placeholder'));
@ -912,11 +971,11 @@ instance.web.WebClient = instance.web.Widget.extend({
self.user_menu.on_action.add(this.proxy('on_menu_action'));
self.user_menu.do_update();
self.bind_hashchange();
var version_label = _t("OpenERP - Unsupported/Community Version");
if (!self.session.openerp_entreprise) {
var version_label = _t("OpenERP - Unsupported/Community Version");
self.$element.find('.oe_footer_powered').append(_.str.sprintf('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">%s</a></span>', version_label));
document.title = version_label;
}
self.set_title();
},
destroy_content: function() {
_.each(_.clone(this.getChildren()), function(el) {
@ -982,12 +1041,22 @@ instance.web.WebClient = instance.web.Widget.extend({
this._current_state = state;
},
do_push_state: function(state) {
this.set_title(state.title);
var url = '#' + $.param(state);
this._current_state = _.clone(state);
$.bbq.pushState(url);
},
on_menu_action: function(action) {
this.action_manager.do_action(action);
on_menu_action: function(options) {
var self = this;
this.rpc("/web/action/load", { action_id: options.action_id })
.then(function (result) {
var action = result.result;
if (options.needaction) {
action.context.search_default_needaction_pending = true;
}
self.action_manager.clear_breadcrumbs();
self.action_manager.do_action(action);
});
},
do_action: function(action) {
var self = this;
@ -1006,31 +1075,36 @@ instance.web.WebClient = instance.web.Widget.extend({
}
});
instance.web.EmbeddedClient = instance.web.Widget.extend({
template: 'EmptyComponent',
init: function(parent, action_id, options) {
this._super(parent);
// TODO take the xmlid of a action instead of its id
instance.web.EmbeddedClient = instance.web.Client.extend({
_template: 'EmbedClient',
init: function(parent, origin, dbname, login, key, action_id, options) {
this._super(parent, origin);
this.dbname = dbname;
this.login = login;
this.key = key;
this.action_id = action_id;
this.options = options || {};
this.am = new instance.web.ActionManager(this);
},
start: function() {
var self = this;
this.am.appendTo(this.$element.addClass('openerp'));
return this.rpc("/web/action/load", { action_id: this.action_id }, function(result) {
var action = result.result;
action.flags = _.extend({
//views_switcher : false,
search_view : false,
action_buttons : false,
sidebar : false
//pager : false
}, self.options, action.flags || {});
return $.when(this._super()).pipe(function() {
return instance.connection.session_authenticate(self.dbname, self.login, self.key, true).pipe(function() {
return self.rpc("/web/action/load", { action_id: self.action_id }, function(result) {
var action = result.result;
action.flags = _.extend({
//views_switcher : false,
search_view : false,
action_buttons : false,
sidebar : false
//pager : false
}, self.options, action.flags || {});
self.am.do_action(action);
self.action_manager.do_action(action);
});
});
});
}
},
});
instance.web.embed = function (origin, dbname, login, key, action, options) {
@ -1044,13 +1118,8 @@ instance.web.embed = function (origin, dbname, login, key, action, options) {
var sc = document.getElementsByTagName('script');
currentScript = sc[sc.length-1];
}
instance.connection.session_bind(origin).then(function () {
instance.connection.session_authenticate(dbname, login, key, true).then(function () {
var client = new instance.web.EmbeddedClient(null, action, options);
client.insertAfter(currentScript);
});
});
var client = new instance.web.EmbeddedClient(null, origin, dbname, login, key, action, options);
client.insertAfter(currentScript);
};
};

View File

@ -99,7 +99,6 @@ openerp.web.corelib = function(instance) {
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" &&
fnTest.test(prop[name]) ?
(function(name, fn) {
return function() {
@ -1396,19 +1395,19 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
} else {
// Indirect jsonp request
var ifid = _.uniqueId('oe_rpc_iframe');
var display = options.openerp.debug ? 'block' : 'none';
var display = self.debug ? 'block' : 'none';
var $iframe = $(_.str.sprintf("<iframe src='javascript:false;' name='%s' id='%s' style='display:%s'></iframe>", ifid, ifid, display));
var $form = $('<form>')
.attr('method', 'POST')
.attr('target', ifid)
.attr('enctype', "multipart/form-data")
.attr('action', ajax.url + '?' + $.param(data))
.attr('action', ajax.url + '?jsonp=1&' + $.param(data))
.append($('<input type="hidden" name="r" />').attr('value', payload_str))
.hide()
.appendTo($('body'));
var cleanUp = function() {
if ($iframe) {
$iframe.unbind("load").attr("src", "javascript:false;").remove();
$iframe.unbind("load").remove();
}
$form.remove();
};

View File

@ -224,6 +224,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
}
return loaded.then(function() {
self.on_modules_loaded();
self.trigger('module_loaded');
if (!no_session_valid_signal) {
self.on_session_valid();
}
@ -333,11 +334,14 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
.appendTo(document.body)
.load(function () {
try {
if (options.error) {
options.error(JSON.parse(
this.contentDocument.body.childNodes[1].textContent
));
}
if (options.error) {
if (!this.contentDocument.body.childNodes[1]) {
options.error(this.contentDocument.body.childNodes);
}
else {
options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent));
}
}
} finally {
complete();
}
@ -400,6 +404,31 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
}
});
/**
* Event Bus used to bind events scoped in the current instance
*/
instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin, {
init: function() {
instance.web.EventDispatcherMixin.init.call(this, parent);
var self = this;
// TODO fme: allow user to bind keys for some global actions.
// check gtk bindings
// http://unixpapa.com/js/key.html
_.each('click,dblclick,keydown,keypress,keyup'.split(','), function(evtype) {
$('html').on(evtype, self, function(ev) {
self.trigger(evtype, ev);
});
});
_.each('resize,scroll'.split(','), function(evtype) {
$(window).on(evtype, self, function(ev) {
self.trigger(evtype, ev);
});
});
}
})
instance.web.bus = new instance.web.Bus();
/** OpenERP Translations */
instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance.web.TranslationDataBase# */{
/**
@ -454,64 +483,6 @@ instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance
}
});
/** Configure default qweb */
instance.web._t = new instance.web.TranslationDataBase().build_translation_function();
/**
* Lazy translation function, only performs the translation when actually
* printed (e.g. inserted into a template)
*
* Useful when defining translatable strings in code evaluated before the
* translation database is loaded, as class attributes or at the top-level of
* an OpenERP Web module
*
* @param {String} s string to translate
* @returns {Object} lazy translation object
*/
instance.web._lt = function (s) {
return {toString: function () { return instance.web._t(s); }}
};
instance.web.qweb = new QWeb2.Engine();
instance.web.qweb.debug = ($.deparam($.param.querystring()).debug != undefined);
instance.web.qweb.default_dict = {
'_' : _,
'_t' : instance.web._t
};
instance.web.qweb.preprocess_node = function() {
// Note that 'this' is the Qweb Node
switch (this.node.nodeType) {
case 3:
case 4:
// Text and CDATAs
var translation = this.node.parentNode.attributes['t-translation'];
if (translation && translation.value === 'off') {
return;
}
var ts = _.str.trim(this.node.data);
if (ts.length === 0) {
return;
}
var tr = instance.web._t(ts);
if (tr !== ts) {
this.node.data = tr;
}
break;
case 1:
// Element
var attr, attrs = ['label', 'title', 'alt'];
while (attr = attrs.pop()) {
if (this.attributes[attr]) {
this.attributes[attr] = instance.web._t(this.attributes[attr]);
}
}
}
};
/** Configure blockui */
if ($.blockUI) {
$.blockUI.defaults.baseZ = 1100;
$.blockUI.defaults.message = '<img src="/web/static/src/img/throbber2.gif">';
}
/** Custom jQuery plugins */
$.fn.getAttributes = function() {
var o = {};
@ -541,10 +512,6 @@ $.Mutex = (function() {
return Mutex;
})();
/** Setup default session */
instance.connection = new instance.web.Session();
instance.web.qweb.default_dict['__debug__'] = instance.connection.debug;
$.async_when = function() {
var async = false;
var def = $.Deferred();
@ -580,6 +547,95 @@ $.async_when = function() {
return old_async_when.apply(this, arguments);
};
/** Setup blockui */
if ($.blockUI) {
$.blockUI.defaults.baseZ = 1100;
$.blockUI.defaults.message = '<img src="/web/static/src/img/throbber2.gif">';
}
/** Setup default session */
instance.connection = new instance.web.Session();
/** Configure default qweb */
instance.web._t = new instance.web.TranslationDataBase().build_translation_function();
/**
* Lazy translation function, only performs the translation when actually
* printed (e.g. inserted into a template)
*
* Useful when defining translatable strings in code evaluated before the
* translation database is loaded, as class attributes or at the top-level of
* an OpenERP Web module
*
* @param {String} s string to translate
* @returns {Object} lazy translation object
*/
instance.web._lt = function (s) {
return {toString: function () { return instance.web._t(s); }}
};
instance.web.qweb = new QWeb2.Engine();
instance.web.qweb.default_dict['__debug__'] = instance.connection.debug; // Which one ?
instance.web.qweb.debug = instance.connection.debug;
instance.web.qweb.default_dict = {
'_' : _,
'_t' : instance.web._t
};
instance.web.qweb.preprocess_node = function() {
// Note that 'this' is the Qweb Node
switch (this.node.nodeType) {
case 3:
case 4:
// Text and CDATAs
var translation = this.node.parentNode.attributes['t-translation'];
if (translation && translation.value === 'off') {
return;
}
var ts = _.str.trim(this.node.data);
if (ts.length === 0) {
return;
}
var tr = instance.web._t(ts);
if (tr !== ts) {
this.node.data = tr;
}
break;
case 1:
// Element
var attr, attrs = ['label', 'title', 'alt', 'placeholder'];
while (attr = attrs.pop()) {
if (this.attributes[attr]) {
this.attributes[attr] = instance.web._t(this.attributes[attr]);
}
}
}
};
/** Setup jQuery timeago */
var _t = instance.web._t;
/*
* Strings in timeago are "composed" with prefixes, words and suffixes. This
* makes their detection by our translating system impossible. Use all literal
* strings we're using with a translation mark here so the extractor can do its
* job.
*/
{
_t('less than a minute ago');
_t('about a minute ago');
_t('%d minutes ago');
_t('about an hour ago');
_t('%d hours ago');
_t('a day ago');
_t('%d days ago');
_t('about a month ago');
_t('%d months ago');
_t('about a year ago');
_t('%d years ago');
}
instance.connection.on('module_loaded', this, function () {
// provide timeago.js with our own translator method
$.timeago.settings.translator = instance.web._t;
});
/**
* Registry for all the client actions key: tag value: widget
*/
@ -589,23 +645,27 @@ instance.web.client_actions = new instance.web.Registry();
* Client action to reload the whole interface.
* If params has an entry 'menu_id', it opens the given menu entry.
*/
instance.web.client_actions.add("reload", "instance.web.Reload");
instance.web.Reload = instance.web.Widget.extend({
init: function(parent, params) {
this._super(parent);
this.menu_id = (params && params.menu_id) || false;
},
start: function() {
var l = window.location;
var timestamp = new Date().getTime();
var search = "?ts=" + timestamp;
if (l.search) {
search = l.search + "&ts=" + timestamp;
}
var hash = l.hash;
if (this.menu_id) {
// open the given menu id
var url_without_fragment = window.location.toString().split("#", 1)[0];
window.location = url_without_fragment + "#menu_id=" + this.menu_id;
} else {
window.location.reload();
hash = "#menu_id=" + this.menu_id;
}
var url = l.protocol + "//" + l.host + l.pathname + search + hash;
window.location = url;
}
});
instance.web.client_actions.add("reload", "instance.web.Reload");
};

View File

@ -55,7 +55,8 @@ instance.web.DataImport = instance.web.Dialog.extend({
.filter(function (field) {
return field.required &&
!_.include(self.fields_with_defaults, field.id); })
.pluck('name')
.pluck('id')
.uniq()
.value();
convert_fields(self);
self.all_fields.sort();
@ -67,7 +68,7 @@ instance.web.DataImport = instance.web.Dialog.extend({
this.open({
buttons: [
{text: _t("Close"), click: function() { self.destroy(); }},
{text: _t("Import File"), click: function() { self.do_import(); }, 'class': 'oe-dialog-import-button'}
{text: _t("Import File"), click: function() { self.do_import(); }, 'class': 'oe_import_dialog_button'}
],
close: function(event, ui) {
self.destroy();
@ -77,7 +78,7 @@ instance.web.DataImport = instance.web.Dialog.extend({
this.$element.find('#csvfile').change(this.on_autodetect_data);
this.$element.find('fieldset').change(this.on_autodetect_data);
this.$element.delegate('fieldset legend', 'click', function() {
$(this).parent().toggleClass('oe-closed');
$(this).parent().toggleClass('oe_closed');
});
this.ready.push(new instance.web.DataSet(this, this.model).call(
'fields_get', [], function (fields) {
@ -133,6 +134,10 @@ instance.web.DataImport = instance.web.Dialog.extend({
switch (field.type) {
case 'many2many':
case 'many2one':
// push a copy for the bare many2one field, to allow importing
// using name_search too - even if we default to exporting the XML ID
var many2one_field = _.extend({}, f)
parent.fields.push(many2one_field);
f.name += '/id';
break;
case 'one2many':
@ -152,7 +157,7 @@ instance.web.DataImport = instance.web.Dialog.extend({
},
toggle_import_button: function (newstate) {
instance.web.dialog(this.$element, 'widget')
.find('.oe-dialog-import-button')
.find('.oe_import_dialog_button')
.button('option', 'disabled', !newstate);
},
do_import: function() {
@ -197,7 +202,7 @@ instance.web.DataImport = instance.web.Dialog.extend({
if (results['error']) {
result_node.append(QWeb.render('ImportView.error', {
'error': results['error']}));
this.$element.find('fieldset').removeClass('oe-closed');
this.$element.find('fieldset').removeClass('oe_closed');
return;
}
if (results['success']) {
@ -219,11 +224,11 @@ instance.web.DataImport = instance.web.Dialog.extend({
: with_headers ? results.records.slice(1)
: results.records
}));
this.$element.find('fieldset').addClass('oe-closed');
this.$element.find('fieldset').addClass('oe_closed');
}
this.$element.find('form').removeClass('oe-import-no-result');
this.$element.find('form').removeClass('oe_import_no_result');
this.$element.delegate('.oe-m2o-drop-down-button', 'click', function () {
this.$element.delegate('.oe_m2o_drop_down_button', 'click', function () {
$(this).prev('input').focus();
});
@ -261,10 +266,14 @@ instance.web.DataImport = instance.web.Dialog.extend({
fields = fields || this.fields;
var f;
f = _(fields).detect(function (field) {
// TODO: levenshtein between header and field.string
return field.name === name
|| field.string.toLowerCase() === name.toLowerCase();
});
if (!f) {
f = _(fields).detect(function (field) {
// TODO: levenshtein between header and field.string
return field.string.toLowerCase() === name.toLowerCase();
});
}
if (f) { return f.name; }
// if ``name`` is a path (o2m), we need to recurse through its .fields
@ -274,9 +283,13 @@ instance.web.DataImport = instance.web.Dialog.extend({
var column_name = name.substring(0, index);
f = _(fields).detect(function (field) {
// field.name for o2m is $foo/id, so we want to match on id
return field.id === column_name
|| field.string.toLowerCase() === column_name.toLowerCase()
return field.id === column_name;
});
if (!f) {
f = _(fields).detect(function (field) {
return field.string.toLowerCase() === column_name.toLowerCase();
});
}
if (!f) { return undefined; }
// if we found a matching field for the first path section, recurse in
@ -330,7 +343,7 @@ instance.web.DataImport = instance.web.Dialog.extend({
if (_.isEmpty(duplicates)) {
this.toggle_import_button(required_valid);
} else {
var $err = $('<div id="msg" style="color: red;">Destination fields should only be selected once, some fields are selected more than once:</div>').insertBefore(this.$element.find('#result'));
var $err = $('<div id="msg" style="color: red;">'+_t("Destination fields should only be selected once, some fields are selected more than once:")+'</div>').insertBefore(this.$element.find('#result'));
var $dupes = $('<dl>').appendTo($err);
_(duplicates).each(function(elements, value) {
$('<dt>').text(value).appendTo($dupes);
@ -344,16 +357,30 @@ instance.web.DataImport = instance.web.Dialog.extend({
},
check_required: function() {
if (!this.required_fields.length) { return true; }
var self = this;
if (!self.required_fields.length) { return true; }
// Resolve field id based on column name, as there may be
// several ways to provide the value for a given field and
// thus satisfy the requirement.
// (e.g. m2o_id or m2o_id/id columns may be provided)
var resolve_field_id = function(column_name) {
var f = _.detect(self.fields, function(field) {
return field.name === column_name;
});
if (!f) { return column_name; };
return f.id;
};
var selected_fields = _(this.$element.find('.sel_fields').get()).chain()
.pluck('value')
.compact()
.map(resolve_field_id)
.value();
var missing_fields = _.difference(this.required_fields, selected_fields);
if (missing_fields.length) {
this.$element.find("#result").before('<div id="message" style="color:red">*Required Fields are not selected : ' + missing_fields + '.</div>');
this.$element.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>');
return false;
}
return true;

View File

@ -118,7 +118,9 @@ instance.web.format_value = function (value, descriptor, value_if_empty) {
return instance.web.insert_thousand_seps(
_.str.sprintf('%d', value));
case 'float':
var precision = descriptor.digits ? descriptor.digits[1] : 2;
var digits = descriptor.digits ? descriptor.digits : [69,2];
digits = typeof digits === "string" ? py.eval(digits) : digits;
var precision = digits[1];
var formatted = _.str.sprintf('%.' + precision + 'f', value).split('.');
formatted[0] = instance.web.insert_thousand_seps(formatted[0]);
return formatted.join(l10n.decimal_point);
@ -307,7 +309,7 @@ instance.web.format_cell = function (row_data, column, options) {
'</button>', {
title: column.string || '',
additional_attributes: isNaN(row_data["id"].value) && instance.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value) ?
'disabled="disabled" class="oe-listview-button-disabled"' : '',
'disabled="disabled" class="oe_list_button_disabled"' : '',
prefix: instance.connection.prefix,
icon: column.icon,
alt: column.string || ''

View File

@ -352,6 +352,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
e.stopImmediatePropagation();
self.$element.toggleClass('oe_searchview_open_drawer');
});
instance.web.bus.on('click', this, function(ev) {
if ($(ev.target).parents('.oe_searchview').length === 0) {
self.$element.removeClass('oe_searchview_open_drawer');
}
});
// Focus last input if the view itself is clicked (empty section of
// facets element)
this.$element.on('click', function (e) {
@ -640,6 +645,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
var drawer_started = $.when.apply(
null, _(this.select_for_drawer()).invoke(
'appendTo', this.$element.find('.oe_searchview_drawer')));
new instance.web.search.AddToDashboard(this).appendTo($('.oe_searchview_drawer', this.$element));
// load defaults
var defaults_fetched = $.when.apply(null, _(this.inputs).invoke(
@ -692,53 +699,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
select.val('');
}
},
on_add_to_dashboard: function() {
this.$element.find(".oe_search-view-filters-management")[0].selectedIndex = 0;
var self = this,
menu = instance.webclient.menu,
$dialog = $(QWeb.render("SearchView.add_to_dashboard", {
dashboards : menu.data.data.children,
selected_menu_id : menu.$element.find('a.active').data('menu')
}));
$dialog.find('input').val(this.fields_view.name);
instance.web.dialog($dialog, {
modal: true,
title: _t("Add to Dashboard"),
buttons: [
{text: _t("Cancel"), click: function() {
$(this).dialog("close");
}},
{text: _t("OK"), click: function() {
$(this).dialog("close");
var menu_id = $(this).find("select").val(),
title = $(this).find("input").val(),
data = self.build_search_data(),
context = new instance.web.CompoundContext(),
domain = new instance.web.CompoundDomain();
_.each(data.contexts, function(x) {
context.add(x);
});
_.each(data.domains, function(x) {
domain.add(x);
});
self.rpc('/web/searchview/add_to_dashboard', {
menu_id: menu_id,
action_id: self.getParent().action.id,
context_to_save: context,
domain: domain,
view_mode: self.getParent().active_view,
name: title
}, function(r) {
if (r === false) {
self.do_warn("Could not add filter to dashboard");
} else {
self.do_notify("Filter added to dashboard", '');
}
});
}}
]
});
},
/**
* Extract search data from the view's facets.
*
@ -1234,7 +1194,7 @@ instance.web.search.Field = instance.web.search.Input.extend( /** @lends instanc
var self = this;
// A field needs a context to send when active
var context = this.attrs.context;
if (!context || !facet.values.length) {
if (_.isEmpty(context) || !facet.values.length) {
return;
}
var contexts = facet.values.map(function (facetValue) {
@ -1530,6 +1490,15 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
return [[name, '=', facetValue.get('value')]];
}
return this._super(name, operator, facetValue);
},
get_context: function (facet) {
var values = facet.values;
if (_.isEmpty(this.attrs.context) && values.length === 1) {
var c = {};
c['default_' + this.attrs.name] = values.at(0).get('value');
return c;
}
return this._super(facet);
}
});
@ -1540,6 +1509,14 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
var self = this;
this.model = new instance.web.Model('ir.filters');
this.filters = {};
this.view.query
.on('remove', function (facet) {
if (!facet.get('is_custom_filter')) {
return;
}
self.clear_selection();
})
.on('reset', this.proxy('clear_selection'));
this.$element.on('submit', 'form', this.proxy('save_current'));
this.$element.on('click', 'h4', function () {
self.$element.toggleClass('oe_opened');
@ -1549,6 +1526,9 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
model: this.view.model
}).pipe(this.proxy('set_filters'));
},
clear_selection: function () {
this.$element.find('li.oe_selected').removeClass('oe_selected');
},
append_filter: function (filter) {
var self = this;
var key = _.str.sprintf('(%s)%s', filter.user_id, filter.name);
@ -1583,8 +1563,10 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
get_groupby: function () { return [filter.context]; },
get_domain: function () { return filter.domain; }
},
is_custom_filter: true,
values: [{label: filter.name, value: null}]
}]);
$filter.addClass('oe_selected');
});
},
set_filters: function (filters) {
@ -1671,6 +1653,77 @@ instance.web.search.Filters = instance.web.search.Input.extend({
}));
}
});
instance.web.search.AddToDashboard = instance.web.Widget.extend({
template: 'SearchView.addtodashboard',
_in_drawer: true,
start: function () {
var self = this;
this.data_loaded = $.Deferred();
this.dashboard_data =[];
this.$element
.on('click', 'h4', this.proxy('show_option'))
.on('submit', 'form', function (e) {
e.preventDefault();
self.add_dashboard();
});
return $.when(this.load_data(),this.data_loaded).pipe(this.proxy("render_data"));
},
load_data:function(){
var self = this,dashboard_menu = instance.webclient.menu.data.data.children;
var ir_model_data = new instance.web.Model('ir.model.data',{},[['name','=','menu_reporting_dashboard']]).query(['res_id']);
var map_data = function(result){
_.detect(dashboard_menu, function(dash){
var id = _.pluck(dash.children, "id"),indexof = _.indexOf(id, result.res_id);
if(indexof !== -1){
self.dashboard_data = dash.children[indexof].children
self.data_loaded.resolve();
return;
}
});
};
return ir_model_data._execute().done(function(result){map_data(result[0])});
},
render_data: function(){
var self = this;
var selection = instance.web.qweb.render("SearchView.addtodashboard.selection",{selections:this.dashboard_data});
this.$element.find("input").before(selection)
},
add_dashboard:function(){
var self = this;
var getParent = this.getParent();
var view_parent = this.getParent().getParent();
if (! view_parent.action || ! this.$element.find("select").val())
return this.do_warn("Can't find dashboard action");
data = getParent.build_search_data(),
context = new instance.web.CompoundContext(getParent.dataset.get_context() || []),
domain = new instance.web.CompoundDomain(getParent.dataset.get_domain() || []);
_.each(data.contexts, function(x) {context.add(x);});
_.each(data.domains, function(x) {domain.add(x);});
this.rpc('/web/searchview/add_to_dashboard', {
menu_id: this.$element.find("select").val(),
action_id: view_parent.action.id,
context_to_save: context,
domain: domain,
view_mode: view_parent.active_view,
name: this.$element.find("input").val()
}, function(r) {
if (r === false) {
self.do_warn("Could not add filter to dashboard");
} else {
self.$element.toggleClass('oe_opened');
self.do_notify("Filter added to dashboard", '');
}
});
},
show_option:function(){
this.$element.toggleClass('oe_opened');
if (! this.$element.hasClass('oe_opened'))
return;
this.$element.find("input").val(this.getParent().fields_view.name || "" );
}
});
instance.web.search.Advanced = instance.web.search.Input.extend({
template: 'SearchView.advanced',
_in_drawer: true,

View File

@ -53,7 +53,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
this.main_view_id = this.parent.fields_view.view_id;
this.action_manager = new instance.web.ActionManager(this);
$.when(this.action_manager.do_action(action)).then(function() {
var viewmanager = self.action_manager.inner_viewmanager,
var viewmanager = self.action_manager.inner_widget,
controller = viewmanager.views[viewmanager.active_view].controller;
self.action_manager.appendTo(self.view_edit_dialog.$element);
self.action_manager.renderElement(self.view_edit_dialog);
@ -88,7 +88,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
} else {
$.when(self.do_save_view(view_values)).then(function() {
self.create_view_dialog.close();
var controller = self.action_manager.inner_viewmanager.views[self.action_manager.inner_viewmanager.active_view].controller;
var controller = self.action_manager.inner_widget.views[self.action_manager.inner_widget.active_view].controller;
controller.reload_content();
});
}
@ -167,7 +167,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
do_delete_view: function() {
var self = this;
if (confirm(_t("Do you really want to remove this view?"))) {
var controller = this.action_manager.inner_viewmanager.views[this.action_manager.inner_viewmanager.active_view].controller;
var controller = this.action_manager.inner_widget.views[this.action_manager.inner_widget.active_view].controller;
this.dataset.unlink([this.main_view_id]).then(function() {
controller.reload_content();
self.main_view_id = self.parent.fields_view.view_id;
@ -397,7 +397,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
action_manager.do_action(action);
}},
{text: _t("Close"), click: function(){
self.action_manager.inner_viewmanager.views[self.action_manager.inner_viewmanager.active_view].controller.reload_content();
self.action_manager.inner_widget.views[self.action_manager.inner_widget.active_view].controller.reload_content();
self.edit_xml_dialog.close();
}}
]
@ -515,21 +515,18 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
}
},
do_node_add: function(side){
var self = this;
var self = this,property_to_check = [];
var tr = self.get_object_by_id(this.one_object.clicked_tr_id, this.one_object['main_object'], [])[0].att_list[0];
var parent_tr = ($(side).prevAll("tr[level=" + String(this.one_object.clicked_tr_level - 1) + "]"))[0];
var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);
parent_tr = $(parent_tr).find('a').text();
parent_tr = self.get_object_by_id(parseInt($(parent_tr).attr('id').replace(/[^0-9]+/g, '')), this.one_object['main_object'], [])[0].att_list[0];
_.each([tr, parent_tr],function(element) {
var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false;
property_to_check.push(value);
});
field_dataset.call( 'fields_get', [], function(result) {
var fields = _.keys(result);
fields.push(" "),fields.sort();
var property_to_check = [];
_.each([tr, parent_tr],function(element) {
property_to_check.push(
_.detect(_.keys(_CHILDREN),function(res){
return _.str.include(element, res);
}));
});
self.on_add_node(property_to_check, fields);
});
},
@ -990,7 +987,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
render_new_field :function( result ) {
var self = this;
var action = {
context: {'default_model_id': result.id, 'manual': true, 'module' : result.modules},
context: {'default_model_id': result.id, 'manual': true, 'module' : result.model},
res_model: "ir.model.fields",
views: [[false, 'form']],
type: 'ir.actions.act_window',
@ -1001,7 +998,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
};
var action_manager = new instance.web.ActionManager(self);
$.when(action_manager.do_action(action)).then(function() {
var controller = action_manager.dialog_viewmanager.views['form'].controller;
var controller = action_manager.dialog_widget.views['form'].controller;
controller.on_button_cancel.add_last(function(){
action_manager.destroy()
});
@ -1168,8 +1165,16 @@ var _CHILDREN = {
'label': [],
'button' : [],
'newline': [],
'separator': []
'separator': [],
'sheet' :['group','field','notebook','label','separator','div','page'],
'kanban' : ['field'],
'html_tag':['notebook', 'group', 'field', 'label', 'button','board', 'newline', 'separator']
//e.g.:xyz 'td' : ['field']
};
// Generic html_tag list and can be added html tag in future. It's support above _CHILDREN dict's *html_tag* by default.
// For specific child node one has to define tag above and specify children tag in list. Like above xyz example.
var html_tag = ['div','h1','h2','h3','h4','h5','h6','td','tr'];
var _ICONS = ['','STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',
'STOCK_CANCEL', 'STOCK_CDROM', 'STOCK_CLEAR', 'STOCK_CLOSE', 'STOCK_COLOR_PICKER',
'STOCK_CONNECT', 'STOCK_CONVERT', 'STOCK_COPY', 'STOCK_CUT', 'STOCK_DELETE',

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
// if true, the view can't be editable, ignoring the view's and the context's
// instructions
'read_only': false,
// if true, the 'Import', 'Export', etc... buttons will be shown
'import_enabled': true,
},
/**
* Core class for list-type displays.
@ -64,7 +66,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.records = new Collection();
this.set_groups(new instance.web.ListView.Groups(this));
this.set_groups(new (this.options.GroupsType)(this));
if (this.dataset instanceof instance.web.DataSetStatic) {
this.groups.datagroup = new instance.web.StaticDataGroup(this.dataset);
@ -87,6 +89,14 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.no_leaf = false;
},
set_default_options: function (options) {
this._super(options);
_.defaults(this.options, {
GroupsType: instance.web.ListView.Groups,
ListType: instance.web.ListView.List
});
},
/**
* Retrieves the view's number of records per page (|| section)
*
@ -132,13 +142,13 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
});
},
/**
* View startup method, the default behavior is to set the ``oe-listview``
* View startup method, the default behavior is to set the ``oe_listw``
* class on its root element and to perform an RPC load call.
*
* @returns {$.Deferred} loading promise
*/
start: function() {
this.$element.addClass('oe-listview');
this.$element.addClass('oe_list');
return this.reload_view(null, null, true);
},
/**
@ -242,18 +252,19 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.setup_columns(this.fields_view.fields, grouped);
this.$element.html(QWeb.render(this._template, this));
this.$element.addClass(this.fields_view.arch.attrs['class']);
// Head hook
// Selecting records
this.$element.find('.all-record-selector').click(function(){
self.$element.find('.oe-record-selector input').prop('checked',
self.$element.find('.all-record-selector').prop('checked') || false);
this.$element.find('.oe_list_record_selector').click(function(){
self.$element.find('.oe_list_record_selector input').prop('checked',
self.$element.find('.oe_list_record_selector').prop('checked') || false);
var selection = self.groups.get_selection();
$(self.groups).trigger(
'selected', [selection.ids, selection.records]);
});
// Sorting columns
this.$element.find('thead').delegate('th.oe-sortable[data-id]', 'click', function (e) {
this.$element.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) {
e.stopPropagation();
var $this = $(this);
self.dataset.sort($this.data('id'));
@ -262,7 +273,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
} else {
$this.toggleClass("sortdown");
}
$this.siblings('.oe-sortable').removeClass("sortup sortdown");
$this.siblings('.oe_sortable').removeClass("sortup sortdown");
self.reload_content();
});
@ -314,7 +325,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
self.page = 0;
}
self.reload_content();
}).find('.oe-pager-state')
}).find('.oe_list_pager_state')
.click(function (e) {
e.stopPropagation();
var $this = $(this);
@ -332,6 +343,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
self._limit = (isNaN(val) ? null : val);
self.page = 0;
self.reload_content();
}).blur(function() {
$(this).trigger('change');
})
.val(self._limit || 'NaN');
});
@ -364,17 +377,19 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
var total = dataset.size();
var limit = this.limit() || total;
this.$pager.toggleClass('oe_list_pager_single_page', (total <= limit));
var spager = '-';
if (total) {
var range_start = this.page * this.limit() + 1;
var range_stop = range_start - 1 + this.limit();
var range_start = this.page * limit + 1;
var range_stop = range_start - 1 + limit;
if (range_stop > total) {
range_stop = total;
}
spager = _.str.sprintf('%d-%d of %d', range_start, range_stop, total);
}
this.$pager.find('.oe-pager-state').text(spager);
this.$pager.find('.oe_list_pager_state').text(spager);
},
/**
* Sets up the listview's columns: merges view and fields data, move
@ -524,10 +539,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
*/
reload_content: function () {
var self = this;
self.$element.find('.all-record-selector').prop('checked', false);
self.$element.find('.oe_list_record_selector').prop('checked', false);
this.records.reset();
var reloaded = $.Deferred();
this.$element.find('.oe-listview-content').append(
this.$element.find('.oe_list_content').append(
this.groups.render(function () {
if (self.dataset.index == null) {
var has_one = false;
@ -548,6 +563,20 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
reload: function () {
return this.reload_content();
},
reload_record: function (record) {
return this.dataset.read_ids(
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field';
}), 'name')
).then(function (records) {
_(records[0]).each(function (value, key) {
record.set(key, value, {silent: true});
});
record.trigger('change', record);
});
},
do_load_state: function(state, warm) {
var reload = false;
if (state.page && this.page !== state.page) {
@ -765,7 +794,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
},
display_aggregates: function (aggregation) {
var self = this;
var $footer_cells = this.$element.find('.oe-list-footer');
var $footer_cells = this.$element.find('.oe_list_footer');
_(this.aggregate_columns).each(function (column) {
if (!column['function']) {
return;
@ -803,9 +832,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
// Padding for column titles, footer and data rows
var $rows = this.$element
.find('.oe-listview-header-columns, tr:not(thead tr)')
.find('.oe_list_header_columns, tr:not(thead tr)')
.not(options['except']);
var newcols = new Array(count+1).join('<td class="oe-listview-padding"></td>');
var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>');
if (options.position === 'before') {
$rows.prepend(newcols);
} else {
@ -816,7 +845,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
* Removes all padding columns of the table
*/
unpad_columns: function () {
this.$element.find('.oe-listview-padding').remove();
this.$element.find('.oe_list_padding').remove();
if (this.previous_colspan) {
this.$element
.find('thead tr:first th')
@ -916,18 +945,18 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
this.$_element = $('<tbody>')
.appendTo(document.body)
.delegate('th.oe-record-selector', 'click', function (e) {
.delegate('th.oe_list_record_selector', 'click', function (e) {
e.stopPropagation();
var selection = self.get_selection();
$(self).trigger(
'selected', [selection.ids, selection.records]);
})
.delegate('td.oe-record-delete button', 'click', function (e) {
.delegate('td.oe_list_record_delete button', 'click', function (e) {
e.stopPropagation();
var $row = $(e.target).closest('tr');
$(self).trigger('deleted', [[self.row_id($row)]]);
})
.delegate('td.oe-field-cell button', 'click', function (e) {
.delegate('td.oe_list_field_cell button', 'click', function (e) {
e.stopPropagation();
var $target = $(e.currentTarget),
field = $target.closest('td').data('field'),
@ -1016,7 +1045,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
render_cell: function () {
return self.render_cell.apply(self, arguments); }
}, this)));
this.pad_table_to(5);
this.pad_table_to(4);
},
pad_table_to: function (count) {
if (this.records.length >= count ||
@ -1025,20 +1054,20 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
}
var cells = [];
if (this.options.selectable) {
cells.push('<th class="oe-record-selector"></td>');
cells.push('<th class="oe_list_record_selector"></td>');
}
_(this.columns).each(function(column) {
if (column.invisible === '1') {
return;
}
if (column.tag === 'button') {
cells.push('<td class="oe-button" title="' + column.string + '">&nbsp;</td>');
cells.push('<td class="oe_button" title="' + column.string + '">&nbsp;</td>');
} else {
cells.push('<td title="' + column.string + '">&nbsp;</td>');
}
});
if (this.options.deletable) {
cells.push('<td class="oe-record-delete"><button type="button" style="visibility: hidden"> </button></td>');
cells.push('<td class="oe_list_record_delete"><button type="button" style="visibility: hidden"> </button></td>');
}
cells.unshift('<tr>');
cells.push('</tr>');
@ -1054,12 +1083,12 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
* @returns {Object} object with the keys ``ids`` and ``records``, holding respectively the ids of all selected records and the records themselves.
*/
get_selection: function () {
var result = {ids: [], records: []};
if (!this.options.selectable) {
return [];
return result;
}
var records = this.records;
var result = {ids: [], records: []};
this.$current.find('th.oe-record-selector input:checked')
this.$current.find('th.oe_list_record_selector input:checked')
.closest('tr').each(function () {
var record = records.get($(this).data('id'));
result.ids.push(record.get('id'));
@ -1101,17 +1130,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
* @returns {$.Deferred} promise to the finalization of the reloading
*/
reload_record: function (record) {
return this.dataset.read_ids(
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field';
}), 'name')
).then(function (records) {
_(records[0]).each(function (value, key) {
record.set(key, value, {silent: true});
});
record.trigger('change', record);
});
return this.view.reload_record(record);
},
/**
* Renders a list record to HTML
@ -1236,7 +1255,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
});
this.$row.children().last()
.append($prev)
.append('<span class="oe-pager-state"></span>')
.append('<span class="oe_list_pager_state"></span>')
.append($next);
},
open: function (point_insertion) {
@ -1274,7 +1293,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
self.records.proxy(group.value).reset();
delete self.children[group.value];
}
var child = self.children[group.value] = new instance.web.ListView.Groups(self.view, {
var child = self.children[group.value] = new (self.view.options.GroupsType)(self.view, {
records: self.records.proxy(group.value),
options: self.options,
columns: self.columns
@ -1302,13 +1321,18 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
}
placeholder.appendChild($row[0]);
var $group_column = $('<th class="oe-group-name">').appendTo($row);
var $group_column = $('<th class="oe_list_group_name">').appendTo($row);
// Don't fill this if group_by_no_leaf but no group_by
if (group.grouped_on) {
var row_data = {};
row_data[group.grouped_on] = group;
var group_column = _(self.columns).detect(function (column) {
return column.id === group.grouped_on; });
if (! group_column) {
throw new Error(_.str.sprintf(
_t("Grouping on field '%s' is not possible because that field does not appear in the list view."),
group.grouped_on));
}
try {
$group_column.html(instance.web.format_cell(
row_data, group_column, {
@ -1352,7 +1376,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
}
});
if (self.options.deletable) {
$row.append('<td class="oe-group-pagination">');
$row.append('<td class="oe_list_group_pagination">');
}
});
return placeholder;
@ -1377,7 +1401,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
},
render_dataset: function (dataset) {
var self = this,
list = new instance.web.ListView.List(this, {
list = new (this.view.options.ListType)(this, {
options: this.options,
columns: this.columns,
dataset: dataset,
@ -1403,11 +1427,11 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
} else {
if (dataset.size() == records.length) {
// only one page
self.$row.find('td.oe-group-pagination').empty();
self.$row.find('td.oe_list_group_pagination').empty();
} else {
var pages = Math.ceil(dataset.size() / limit);
self.$row
.find('.oe-pager-state')
.find('.oe_list_pager_state')
.text(_.str.sprintf(_t("%(page)d/%(page_count)d"), {
page: page + 1,
page_count: pages

View File

@ -125,29 +125,27 @@ openerp.web.list_editable = function (instance) {
* Checks if a record is being edited, and if so cancels it
*/
cancel_pending_edition: function () {
var self = this, cancelled = $.Deferred();
var self = this, cancelled;
if (!this.edition) {
cancelled.resolve();
return cancelled.promise();
return $.when();
}
if (this.edition_id != null) {
this.reload_record(self.records.get(this.edition_id)).then(function () {
cancelled.resolve();
});
if (this.edition_id) {
cancelled = this.reload_record(this.records.get(this.edition_id));
} else {
cancelled.resolve();
cancelled = $.when();
}
cancelled.then(function () {
self.view.unpad_columns();
self.edition_form.destroy();
self.edition_form.$element.remove();
delete self.edition_form;
self.dataset.index = null;
delete self.edition_id;
delete self.edition;
});
this.pad_table_to(5);
return cancelled.promise();
return cancelled;
},
/**
* Adapts this list's view description to be suitable to the inner form
@ -171,24 +169,29 @@ openerp.web.list_editable = function (instance) {
var self = this;
switch (e.which) {
case KEY_RETURN:
this.save_row().then(function (result) {
if (result.created) {
self.new_record();
return;
}
$(e.target).blur();
e.preventDefault();
//e.stopImmediatePropagation();
setTimeout(function () {
self.save_row().then(function (result) {
if (result.created) {
self.new_record();
return;
}
var next_record_id,
next_record = self.records.at(
self.records.indexOf(result.edited_record) + 1);
if (next_record) {
next_record_id = next_record.get('id');
self.dataset.index = _(self.dataset.ids)
.indexOf(next_record_id);
} else {
self.dataset.index = 0;
next_record_id = self.records.at(0).get('id');
}
self.edit_record(next_record_id);
var next_record_id,
next_record = self.records.at(
self.records.indexOf(result.edited_record) + 1);
if (next_record) {
next_record_id = next_record.get('id');
self.dataset.index = _(self.dataset.ids)
.indexOf(next_record_id);
} else {
self.dataset.index = 0;
next_record_id = self.records.at(0).get('id');
}
self.edit_record(next_record_id);
}, 0);
});
break;
case KEY_ESCAPE:
@ -198,15 +201,16 @@ openerp.web.list_editable = function (instance) {
},
render_row_as_form: function (row) {
var self = this;
this.cancel_pending_edition().then(function () {
return this.ensure_saved().pipe(function () {
var record_id = $(row).data('id');
var $new_row = $('<tr>', {
id: _.uniqueId('oe-editable-row-'),
'data-id': record_id,
'class': (row ? $(row).attr('class') : '') + ' oe_form',
'class': (row ? $(row).attr('class') : ''),
click: function (e) {e.stopPropagation();}
})
.delegate('button.oe-edit-row-save', 'click', function () {
.addClass('oe_form oe_form_container')
.delegate('button.oe_list_edit_row_save', 'click', function () {
self.save_row();
})
.delegate('button', 'keyup', function (e) {
@ -214,7 +218,13 @@ openerp.web.list_editable = function (instance) {
})
.keyup(function () {
return self.on_row_keyup.apply(self, arguments); })
.keydown(function (e) { e.stopPropagation(); });
.keydown(function (e) { e.stopPropagation(); })
.keypress(function (e) {
if (e.which === KEY_RETURN) {
return false;
}
});
if (row) {
$new_row.replaceAll(row);
} else if (self.options.editable) {
@ -236,17 +246,19 @@ openerp.web.list_editable = function (instance) {
}
self.edition = true;
self.edition_id = record_id;
$new_row.addClass("oe_form_container");
self.edition_form = new instance.web.ListEditableFormView(self.view, self.dataset, false);
self.edition_form.$element = $new_row;
self.edition_form.editable_list = self;
// HO HO
// empty
$.when(self.edition_form.on_loaded(self.get_form_fields_view())).then(function () {
// put in $.when just in case FormView.on_loaded becomes asynchronous
self.dataset.index = _(self.dataset.ids).indexOf(record_id);
if (self.dataset.index === -1) {
self.dataset.index = null;
}
self.edition_form = _.extend(new instance.web.ListEditableFormView(self.view, self.dataset, false), {
$element: $new_row,
editable_list: self
});
// put in $.when just in case FormView.on_loaded becomes asynchronous
return $.when(self.edition_form.on_loaded(self.get_form_fields_view())).then(function () {
$new_row.find('> td')
.end()
.find('td:last').removeClass('oe-field-cell').end();
.find('td:last').removeClass('oe_list_field_cell').end();
// pad in case of groupby
_(self.columns).each(function (column) {
if (column.meta) {
@ -299,7 +311,7 @@ openerp.web.list_editable = function (instance) {
*/
save_row: function () {
//noinspection JSPotentiallyInvalidConstructorUsage
var self = this, done = $.Deferred();
var self = this;
return this.edition_form
.do_save(null, this.options.editable === 'top')
.pipe(function (result) {
@ -319,18 +331,24 @@ openerp.web.list_editable = function (instance) {
created: result.created || false,
edited_record: edited_record
};
}, null);
}, null);
});
});
},
/**
* If the current list is being edited, ensures it's saved
*/
ensure_saved: function () {
if (this.edition) {
return this.save_row();
// kinda-hack-ish: if the user has entered data in a field,
// oe_form_dirty will be set on the form so save, otherwise
// discard the current (entirely empty) line
if (this.edition_form.$element.is('.oe_form_dirty')) {
return this.save_row();
}
return this.cancel_pending_edition();
}
//noinspection JSPotentiallyInvalidConstructorUsage
return $.Deferred().resolve().promise();
return $.when();
},
/**
* Cancels the edition of the row for the current dataset index
@ -349,7 +367,6 @@ openerp.web.list_editable = function (instance) {
[record_id, this.dataset]);
},
new_record: function () {
this.dataset.index = null;
this.render_row_as_form();
},
render_record: function (record) {
@ -420,8 +437,7 @@ openerp.web.list_editable = function (instance) {
w.appendTo($td);
$td.appendTo($element);
});
save = QWeb.render('ListView.row.save');
$(save).appendTo($element);
$(QWeb.render('ListView.row.save')).appendTo($element);
},
});
};

View File

@ -63,6 +63,12 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
}
return fields;
},
store_record:function(records){
var self = this;
_(records).each(function (record) {
self.records[record.id] = record;
});
},
on_loaded: function (fields_view) {
var self = this;
var has_toolbar = !!fields_view.arch.attrs.toolbar;
@ -84,19 +90,22 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
'fields': this.fields,
'toolbar': has_toolbar
}));
this.$element.addClass(this.fields_view.arch.attrs['class']);
this.dataset.read_slice(this.fields_list()).then(function(records) {
self.store_record(records);
if (!has_toolbar) {
// WARNING: will do a second read on the same ids, but only on
// first load so not very important
self.getdata(null, _(records).pluck('id'));
self.render_data({'null':records})
self.getdata(_.pluck(records,"id"));
return;
}
var $select = self.$element.find('select')
.change(function () {
var $option = $(this).find(':selected');
self.getdata($option.val(), $option.data('children'));
self.getdata($option.val());
});
_(records).each(function (record) {
self.records[record.id] = record;
@ -111,7 +120,12 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
$select.change();
}
});
this.$element.find("#tree_view_expand").click(function(){
self.expand_all();
});
this.$element.find("#tree_view_collapse").click(function(){
self.collpase_all();
});
// TODO store open nodes in url ?...
this.do_push_state({});
@ -127,6 +141,22 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
return [color, py.parse(py.tokenize(expr)), expr];
}).value();
},
expand_all: function(){
var self = this;
var tr = this.$element.find(".oe-treeview-table tbody tr[id^='treerow_']");
_.each(tr,function(rec){
self.showcontent($(rec).attr('data-id'),true);
});
},
collpase_all: function(){
var self = this;
var root_tr = this.$element.find(".oe-treeview-table tbody tr[data-level='"+1+"']");
_.each(root_tr,function(rec){
if($(rec).hasClass('oe_open')){
self.showcontent($(rec).attr('data-id'),false);
}
});
},
/**
* Returns the color for the provided record in the current view (from the
* ``@colors`` attribute)
@ -163,59 +193,55 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
});
this.$element.delegate('.treeview-tr', 'click', function () {
var is_loaded = 0,
$this = $(this),
var $this = $(this),
record_id = $this.data('id'),
record = self.records[record_id],
children_ids = record[self.children_field];
_(children_ids).each(function(childid) {
if (self.$element.find('#treerow_' + childid).length) {
if (self.$element.find('#treerow_' + childid).is(':hidden')) {
is_loaded = -1;
} else {
is_loaded++;
}
}
});
if (is_loaded === 0) {
if (!$this.parent().hasClass('oe-open')) {
self.getdata(record_id, children_ids);
}
} else {
self.showcontent(record_id, is_loaded < 0);
}
bool = $this.parent().hasClass('oe_open');
self.showcontent(record_id, !bool);
});
},
// get child data of selected value
getdata: function (id, children_ids) {
getdata: function (id) {
var self = this;
self.dataset.read_ids(children_ids, this.fields_list()).then(function(records) {
_(records).each(function (record) {
self.records[record.id] = record;
});
var $curr_node = self.$element.find('#treerow_' + id);
var parent_child ={};
id = _.isArray(id)?id:parseInt(id);
var ir_model_data = new instance.web.Model(this.model,self.dataset.get_context() || {},[['id','child_of',id]]).query();
ir_model_data._execute().then(function(records){
self.store_record(records);
_.each(records,function(rec){
if(rec[self.children_field].length === 0)return;
parent_child[rec.id] = [];
_.each(rec[self.children_field],function(key){
parent_child[rec.id].push(self.records[key]);
});
})
self.render_data(parent_child);
});
},
render_data: function(groupby){
var self = this;
_.each(_.keys(groupby),function(key){
var $curr_node = self.$element.find('#treerow_' + key);
var record = groupby[key];
var children_rows = QWeb.render('TreeView.rows', {
'records': records,
'records': record,
'children_field': self.children_field,
'fields_view': self.fields_view.arch.children,
'fields': self.fields,
'level': $curr_node.data('level') || 0,
'level': ($curr_node.data('level') || 0) + 1,
'render': instance.web.format_value,
'color_for': self.color_for
});
if ($curr_node.length) {
$curr_node.addClass('oe-open');
$curr_node.addClass('oe_open');
$curr_node.after(children_rows);
} else {
self.$element.find('tbody').html(children_rows);
}
});
self.collpase_all();
},
// Get details in listview
activate: function(id) {
var self = this;
@ -247,24 +273,16 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
// show & hide the contents
showcontent: function (record_id, show) {
this.$element.find('#treerow_' + record_id)
.toggleClass('oe-open', show);
.toggleClass('oe_open', show);
_(this.records[record_id][this.children_field]).each(function (child_id) {
var $child_row = this.$element.find('#treerow_' + child_id);
if ($child_row.hasClass('oe-open')) {
if ($child_row.hasClass('oe_open')) {
this.showcontent(child_id, false);
}
$child_row.toggle(show);
}, this);
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
this.hidden = true;
}
});
};

View File

@ -10,32 +10,116 @@ instance.web.ActionManager = instance.web.Widget.extend({
init: function(parent) {
this._super(parent);
this.inner_action = null;
this.inner_viewmanager = null;
this.inner_widget = null;
this.dialog = null;
this.dialog_viewmanager = null;
this.client_widget = null;
this.dialog_widget = null;
this.breadcrumbs = [];
},
start: function() {
this._super.apply(this, arguments);
this.$element.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked);
},
dialog_stop: function () {
if (this.dialog) {
this.dialog_viewmanager.destroy();
this.dialog_viewmanager = null;
this.dialog_widget.destroy();
this.dialog_widget = null;
this.dialog.destroy();
this.dialog = null;
}
},
content_stop: function () {
if (this.inner_viewmanager) {
this.inner_viewmanager.destroy();
this.inner_viewmanager = null;
/**
* Add a new item to the breadcrumb
*
* If the title of an item is an array, the multiple title mode is in use.
* (eg: a widget with multiple views might need to display a title for each view)
* In multiple title mode, the show() callback can check the index it receives
* in order to detect which of its titles has been clicked on by the user.
*
* @param {Object} item breadcrumb item
* @param {Object} item.widget widget containing the view(s) to be added to the breadcrumb added
* @param {Function} [item.show] triggered whenever the widget should be shown back
* @param {Function} [item.hide] triggered whenever the widget should be shown hidden
* @param {Function} [item.destroy] triggered whenever the widget should be destroyed
* @param {String|Array} [item.title] title(s) of the view(s) to be displayed in the breadcrumb
* @param {Function} [item.get_title] should return the title(s) of the view(s) to be displayed in the breadcrumb
*/
push_breadcrumb: function(item) {
var last = this.breadcrumbs.slice(-1)[0];
if (last) {
last.hide();
}
if (this.client_widget) {
this.client_widget.destroy();
this.client_widget = null;
var item = _.extend({
show: function(index) {
this.widget.$element.show();
},
hide: function() {
this.widget.$element.hide();
},
destroy: function() {
this.widget.destroy();
},
get_title: function() {
return this.title || this.widget.get('title');
}
}, item);
item.id = _.uniqueId('breadcrumb_');
this.breadcrumbs.push(item);
},
on_breadcrumb_clicked: function(ev) {
var $e = $(ev.target);
var id = $e.data('id');
var item;
for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
var it = this.breadcrumbs[i];
if (it.id == id) {
item = it;
break;
}
this.remove_breadcrumb(i);
}
var index = $e.parent().find('.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e);
item.show(index, $e);
this.inner_widget = item.widget;
},
clear_breadcrumbs: function() {
while (this.breadcrumbs.length) {
this.remove_breadcrumb(0);
}
},
remove_breadcrumb: function(index) {
var item = this.breadcrumbs.splice(index, 1)[0];
if (item) {
var dups = _.filter(this.breadcrumbs, function(it) {
return item.widget === it.widget;
});
if (!dups.length) {
item.destroy();
}
}
},
get_title: function() {
var titles = [];
for (var i = 0; i < this.breadcrumbs.length; i += 1) {
var item = this.breadcrumbs[i];
var tit = item.get_title();
if (!_.isArray(tit)) {
tit = [tit];
}
for (var j = 0; j < tit.length; j += 1) {
var label = _.escape(tit[j]);
if (i === this.breadcrumbs.length - 1 && j === tit.length - 1) {
titles.push(label);
} else {
titles.push(_.str.sprintf('<a href="#" class="oe_breadcrumb_item" data-id="%s">%s</a>', item.id, label));
}
}
}
return titles.join(' <span class="oe_fade">/</span> ');
},
do_push_state: function(state) {
if (this.getParent() && this.getParent().do_push_state) {
if (this.inner_action) {
state['title'] = this.inner_action.name;
state['model'] = this.inner_action.res_model;
if (this.inner_action.id) {
state['action_id'] = this.inner_action.id;
@ -48,7 +132,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
var self = this,
action_loaded;
if (state.action_id) {
var run_action = (!this.inner_viewmanager) || this.inner_viewmanager.action.id !== state.action_id;
var run_action = (!this.inner_widget || !this.inner_widget.action) || this.inner_widget.action.id !== state.action_id;
if (run_action) {
this.null_action();
action_loaded = this.do_action(state.action_id);
@ -77,17 +161,24 @@ instance.web.ActionManager = instance.web.Widget.extend({
});
} else if (state.client_action) {
this.null_action();
this.ir_actions_client(state.client_action);
var action = state.client_action;
if(_.isString(action)) {
action = {
tag: action,
params: state,
};
}
this.ir_actions_client(action);
}
$.when(action_loaded || null).then(function() {
if (self.inner_viewmanager) {
self.inner_viewmanager.do_load_state(state, warm);
if (self.inner_widget && self.inner_widget.do_load_state) {
self.inner_widget.do_load_state(state, warm);
}
});
},
do_action: function(action, on_close) {
if (_.isNumber(action)) {
if (_.isNumber(action) || _.isString(action)) {
var self = this;
return self.rpc("/web/action/load", { action_id: action }, function(result) {
self.do_action(result.result, on_close);
@ -116,7 +207,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
},
null_action: function() {
this.dialog_stop();
this.content_stop();
this.clear_breadcrumbs();
},
ir_actions_act_window: function (action, on_close) {
var self = this;
@ -128,28 +219,32 @@ instance.web.ActionManager = instance.web.Widget.extend({
};
}
if (action.target === 'new') {
if (this.dialog == null) {
this.dialog = new instance.web.Dialog(this, { width: '80%' });
if (this.dialog === null) {
// These buttons will be overwrited by <footer> if any
this.dialog = new instance.web.Dialog(this, {
buttons: { "Close": function() { $(this).dialog("close"); }},
dialogClass: 'oe_act_window'
});
if(on_close)
this.dialog.on_close.add(on_close);
} else {
this.dialog_viewmanager.destroy();
this.dialog_widget.destroy();
}
this.dialog.dialog_title = action.name;
this.dialog_viewmanager = new instance.web.ViewManagerAction(this, action);
this.dialog_viewmanager.appendTo(this.dialog.$element);
this.dialog_widget = new instance.web.ViewManagerAction(this, action);
this.dialog_widget.appendTo(this.dialog.$element);
this.dialog.open();
} else {
this.dialog_stop();
this.content_stop();
if(action.menu_id) {
return this.getParent().do_action(action, function () {
instance.webclient.menu.open_menu(action.menu_id);
});
}
this.inner_action = action;
this.inner_viewmanager = new instance.web.ViewManagerAction(this, action);
this.inner_viewmanager.appendTo(this.$element);
var inner_widget = this.inner_widget = new instance.web.ViewManagerAction(this, action);
inner_widget.add_breadcrumb();
this.inner_widget.appendTo(this.$element);
}
},
ir_actions_act_window_close: function (action, on_closed) {
@ -168,10 +263,14 @@ instance.web.ActionManager = instance.web.Widget.extend({
});
},
ir_actions_client: function (action) {
this.content_stop();
this.dialog_stop();
var ClientWidget = instance.web.client_actions.get_object(action.tag);
(this.client_widget = new ClientWidget(this, action.params)).appendTo(this.$element);
this.inner_widget = new ClientWidget(this, action.params);
this.push_breadcrumb({
widget: this.inner_widget,
title: action.name
});
this.inner_widget.appendTo(this.$element);
},
ir_actions_report_xml: function(action, on_closed) {
var self = this;
@ -280,35 +379,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
this.active_view = view_type;
if (!view.controller) {
// Lazy loading of views
var controllerclass = this.registry.get_object(view_type);
var options = _.clone(view.options);
if (view_type === "form" && this.action) {
switch (this.action.target) {
case 'new':
case 'inline':
options.initial_mode = 'edit';
break;
}
}
var controller = new controllerclass(this, this.dataset, view.view_id, options);
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
controller.do_switch_view.add_last(_.bind(this.switch_view, this));
controller.do_prev_view.add_last(this.on_prev_view);
var container = this.$element.find(".oe_view_manager_view_" + view_type);
view_promise = controller.appendTo(container);
this.views[view_type].controller = controller;
this.views[view_type].deferred.resolve(view_type);
$.when(view_promise).then(function() {
self.on_controller_inited(view_type, controller);
if (self.searchview
&& self.flags.auto_search
&& view.controller.searchable !== false) {
self.searchview.ready.then(self.searchview.do_search);
}
});
view_promise = this.do_create_view(view_type);
} else if (this.searchview
&& self.flags.auto_search
&& view.controller.searchable !== false) {
@ -320,7 +391,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
}
this.$element
.find('.oe_view_manager_switch a').parent().removeClass('active')
.find('.oe_view_manager_switch a').parent().removeClass('active');
this.$element
.find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]')
.parent().addClass('active');
@ -329,19 +400,98 @@ instance.web.ViewManager = instance.web.Widget.extend({
_.each(_.keys(self.views), function(view_name) {
var controller = self.views[view_name].controller;
if (controller) {
var container = self.$element.find(".oe_view_manager_view_" + view_name + ":first");
if (view_name === view_type) {
container.show();
controller.do_show(view_options || {});
} else {
container.hide();
controller.do_hide();
}
// put the <footer> in the dialog's buttonpane
if (self.$element.parent('.ui-dialog-content') && self.$element.find('footer')) {
self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide()
self.$element.find('footer').appendTo(
self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane')
);
}
}
});
self.$element.find('.oe_view_title_text:first').text(
self.display_title());
});
return view_promise;
},
do_create_view: function(view_type) {
// Lazy loading of views
var self = this;
var view = this.views[view_type];
var controllerclass = this.registry.get_object(view_type);
var options = _.clone(view.options);
if (view_type === "form" && this.action) {
switch (this.action.target) {
case 'new':
case 'inline':
options.initial_mode = 'edit';
break;
}
}
var controller = new controllerclass(this, this.dataset, view.view_id, options);
controller.on("change:title", this, function() {
if (self.active_view === view_type) {
self.set_title(controller.get('title'));
}
});
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
controller.do_switch_view.add_last(_.bind(this.switch_view, this));
controller.do_prev_view.add_last(this.on_prev_view);
var container = this.$element.find(".oe_view_manager_view_" + view_type);
var view_promise = controller.appendTo(container);
this.views[view_type].controller = controller;
this.views[view_type].deferred.resolve(view_type);
return $.when(view_promise).then(function() {
self.on_controller_inited(view_type, controller);
if (self.searchview
&& self.flags.auto_search
&& view.controller.searchable !== false) {
self.searchview.ready.then(self.searchview.do_search);
}
});
},
set_title: function(title) {
this.$element.find('.oe_view_title_text:first').text(title);
},
add_breadcrumb: function() {
var self = this;
var views = [this.active_view || this.views_src[0].view_type];
this.on_mode_switch.add(function(mode) {
var last = views.slice(-1)[0];
if (mode !== last) {
if (mode !== 'form') {
views.length = 0;
}
views.push(mode);
}
});
this.getParent().push_breadcrumb({
widget: this,
show: function(index, $e) {
var view_to_select = views[index];
self.$element.show();
if (self.active_view !== view_to_select) {
self.on_mode_switch(view_to_select);
}
},
get_title: function() {
return _.map(views, function(v) {
return self.views[v].controller.get('title');
});
}
});
},
/**
* Method used internally when a view asks to switch view. This method is meant
* to be extended by child classes to change the default behavior, which simply
@ -434,14 +584,6 @@ instance.web.ViewManager = instance.web.Widget.extend({
*/
on_action_executed: function () {
},
display_title: function () {
var view = this.views[this.active_view];
if (view) {
// ick
return view.controller.fields_view.arch.attrs.string;
}
return '';
}
});
instance.web.ViewManagerAction = instance.web.ViewManager.extend({
@ -486,7 +628,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
if (this.session.hidden_menutips) {
return;
}
this.session.hidden_menutips = {}
this.session.hidden_menutips = {};
},
/**
* Initializes the ViewManagerAction: sets up the searchview (if the
@ -514,32 +656,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
var manager_ready = $.when(searchview_loaded, main_view_loaded);
this.$element.find('.oe_debug_view').change(this.on_debug_changed);
if (this.action.help && !this.flags.low_profile) {
var Users = new instance.web.DataSet(self, 'res.users'),
$tips = this.$element.find('.oe_view_manager_menu_tips');
$tips.delegate('blockquote button', 'click', function() {
var $this = $(this);
//noinspection FallthroughInSwitchStatementJS
switch ($this.attr('name')) {
case 'disable':
Users.write(self.session.uid, {menu_tips:false});
case 'hide':
$this.closest('blockquote').hide();
self.session.hidden_menutips[self.action.id] = true;
}
});
if (!(self.action.id in self.session.hidden_menutips)) {
Users.read_ids([this.session.uid], ['menu_tips']).then(function(users) {
var user = users[0];
if (!(user && user.id === self.session.uid)) {
return;
}
$tips.find('blockquote').toggle(user.menu_tips);
});
}
}
this.$element.addClass("oe_view_manager_" + (this.action.target || 'current'));
return manager_ready;
},
on_debug_changed: function (evt) {
@ -662,12 +779,18 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
view: controller,
view_manager: self
}));
if (!self.action.name && fvg) {
self.$element.find('.oe_view_title_text').text(fvg.arch.attrs.string || fvg.name);
}
self.set_title();
});
},
do_create_view: function(view_type) {
var r = this._super.apply(this, arguments);
var view = this.views[view_type].controller;
view.set({ 'title': this.action.name });
return r;
},
set_title: function(title) {
this.$element.find('.oe_breadcrumb_title:first').html(this.getParent().get_title());
},
do_push_state: function(state) {
if (this.getParent() && this.getParent().do_push_state) {
state["view_type"] = this.active_view;
@ -689,13 +812,11 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
self.views[self.active_view].controller.do_load_state(state, warm);
});
},
display_title: function () {
return this.action.name;
}
});
instance.web.Sidebar = instance.web.Widget.extend({
init: function(parent) {
var self = this;
this._super(parent);
var view = this.getParent();
this.sections = [
@ -712,19 +833,24 @@ instance.web.Sidebar = instance.web.Widget.extend({
var item = { label: _t("Translate"), callback: view.on_sidebar_translate, title: _t("Technical translation") };
this.items.other.push(item);
}
this.fileupload_id = _.uniqueId('oe_fileupload');
$(window).on(this.fileupload_id, function() {
var args = [].slice.call(arguments).slice(1);
if (args[0] && args[0].error) {
alert(args[0].error);
} else {
self.do_attachement_update(self.dataset, self.model_id);
}
$.unblockUI();
});
},
start: function() {
var self = this;
this._super(this);
this.redraw();
this.$element.on('click','.oe_dropdown_toggle',function(event) {
$(this).parent().find('ul').toggle();
return false;
});
this.$element.on('click','.oe_dropdown_menu li a', function(event) {
var section = $(this).data('section');
var index = $(this).data('index');
$(this).closest('ul').hide();
var item = self.items[section][index];
if (item.callback) {
item.callback.apply(self, [item]);
@ -733,16 +859,12 @@ instance.web.Sidebar = instance.web.Widget.extend({
} else if (item.url) {
return true;
}
return false;
event.preventDefault();
});
//this.$div.html(QWeb.render('FormView.sidebar.attachments', this));
//this.$element.find('.oe-binary-file').change(this.on_attachment_changed);
//this.$element.find('.oe-sidebar-attachment-delete').click(this.on_attachment_delete);
},
redraw: function() {
var self = this;
self.$element.html(QWeb.render('Sidebar', {widget: self}));
this.$element.find('ul').hide();
// Hides Sidebar sections when item list is empty
this.$('.oe_form_dropdown_section').each(function() {
@ -826,6 +948,8 @@ instance.web.Sidebar = instance.web.Widget.extend({
});
},
do_attachement_update: function(dataset, model_id) {
this.dataset = dataset;
this.model_id = model_id;
if (!model_id) {
this.on_attachments_loaded([]);
} else {
@ -837,42 +961,37 @@ instance.web.Sidebar = instance.web.Widget.extend({
on_attachments_loaded: function(attachments) {
var self = this;
var items = [];
// TODO: preprend: _s +
var prefix = '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=name&id=';
var prefix = this.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=name&id=';
_.each(attachments,function(a) {
a.label = a.name;
if(a.type === "binary") {
a.url = prefix + a.id + '&t=' + (new Date().getTime());
}
});
attachments.push( { label: _t("Add..."), callback: self.on_attachment_add } );
self.items['files'] = attachments;
self.redraw();
},
on_attachment_add: function(e) {
this.$element.find('.oe_sidebar_add').show();
this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed);
this.$element.find('.oe_sidebar_delete_item').click(this.on_attachment_delete);
},
on_attachment_changed: function(e) {
return;
window[this.element_id + '_iframe'] = this.do_update;
var $e = $(e.target);
if ($e.val() != '') {
this.$element.find('form.oe-binary-form').submit();
if ($e.val() !== '') {
this.$element.find('form.oe_form_binary_form').submit();
$e.parent().find('input[type=file]').prop('disabled', true);
$e.parent().find('button').prop('disabled', true).find('img, span').toggle();
this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...'));
$.blockUI();
}
},
on_attachment_delete: function(e) {
return;
var self = this, $e = $(e.currentTarget);
var name = _.str.trim($e.parent().find('a.oe-sidebar-attachments-link').text());
if (confirm(_.str.sprintf(_t("Do you really want to delete the attachment %s?"), name))) {
this.rpc('/web/dataset/unlink', {
model: 'ir.attachment',
ids: [parseInt($e.attr('data-id'))]
}, function(r) {
$e.parent().remove();
self.do_notify("Delete an attachment", "The attachment '" + name + "' has been deleted");
var self = this;
e.preventDefault();
e.stopPropagation();
var self = this;
var $e = $(e.currentTarget);
if (confirm(_t("Do you really want to delete this attachment ?"))) {
(new instance.web.DataSet(this, 'ir.attachment')).unlink([parseInt($e.attr('data-id'), 10)]).then(function() {
self.do_attachement_update(self.dataset, self.model_id);
});
}
}
@ -884,8 +1003,8 @@ instance.web.TranslateDialog = instance.web.Dialog.extend({
// TODO fme: should add the language to fields_view_get because between the fields view get
// and the moment the user opens the translation dialog, the user language could have been changed
this.view_language = view.session.user_context.lang;
this['on_button' + _t("Save")] = this.on_button_Save;
this['on_button' + _t("Close")] = this.on_button_Close;
this['on_button_' + _t("Save")] = this.on_btn_save;
this['on_button_' + _t("Close")] = this.on_btn_close;
this._super(view, {
width: '80%',
height: '80%'
@ -966,7 +1085,7 @@ instance.web.TranslateDialog = instance.web.Dialog.extend({
}
});
},
on_button_Save: function() {
on_btn_save: function() {
var trads = {},
self = this,
trads_mutex = new $.Mutex();
@ -989,7 +1108,7 @@ instance.web.TranslateDialog = instance.web.Dialog.extend({
});
this.close();
},
on_button_Close: function() {
on_btn_close: function() {
this.close();
}
});
@ -1118,7 +1237,7 @@ instance.web.View = instance.web.Widget.extend({
args.push(context);
return dataset.call_button(action_data.name, args, handler);
} else if (action_data.type=="action") {
return this.rpc('/web/action/load', { action_id: parseInt(action_data.name, 10), context: context, do_not_eval: true}, handler);
return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}, handler);
} else {
return dataset.exec_workflow(record_id, action_data.name, handler);
}

View File

@ -27,9 +27,9 @@
</t>
<t t-name="CrashManager.warning">
<table cellspacing="0" cellpadding="0" border="0" class="oe-dialog-warning">
<table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">
<tr>
<td><img t-att-src='_s + "/web/static/src/img/warning.png"' class="oe-dialog-icon"/></td>
<td><img t-att-src='_s + "/web/static/src/img/warning.png"' class="oe_dialog_icon"/></td>
<td>
<p>
<t t-js="d">
@ -117,7 +117,7 @@
<t t-name="DatabaseManager">
<div class="oe_database_manager">
<div class="oe_database_manager_menu">
<ul class="oe_form_notebook">
<ul class="oe_notebook">
<li><a href="#db_create">Create</a></li>
<li><a href="#db_drop">Drop</a></li>
<li><a href="#db_backup">Backup</a></li>
@ -273,8 +273,10 @@
</t>
<t t-name="Menu.more">
<li class="oe_menu_more_container">
<a href="#" class="oe_menu_more_link oe_dropdown_toggle">More</a>
<ul class="oe_menu_more" style="display: none;"/>
<span class="oe_topbar_item oe_menu_more_link oe_dropdown_toggle oe_dropdown_arrow">
More
<ul class="oe_menu_more oe_dropdown_menu"/>
</span>
</li>
</t>
<t t-name="Menu.secondary">
@ -316,19 +318,15 @@
</t>
<t t-name="UserMenu">
<ul class="oe_user_menu oe_topbar_item">
<li class="oe_dropdown">
<a href="#" class="oe_dropdown_toggle">
<img class="oe_topbar_avatar" t-att-data-default-src="_s + '/web/static/src/img/user_menu_avatar.png'"/>
<span class="oe_topbar_name"/>
</a>
<ul class="oe_dropdown_options">
<li><a href="#" data-menu="about">About OpenERP</a></li>
<li><a href="#" data-menu="settings">Preferences</a></li>
<li><a href="#" data-menu="logout">Log out</a></li>
</ul>
</li>
</ul>
<span class="oe_user_menu oe_topbar_item oe_dropdown_toggle oe_dropdown_arrow">
<img class="oe_topbar_avatar" t-att-data-default-src="_s + '/web/static/src/img/user_menu_avatar.png'"/>
<span class="oe_topbar_name"/>
<ul class="oe_dropdown_menu">
<li><a href="#" data-menu="about">About OpenERP</a></li>
<li><a href="#" data-menu="settings">Preferences</a></li>
<li><a href="#" data-menu="logout">Log out</a></li>
</ul>
</span>
</t>
<t t-name="UserMenu.about">
<div>
@ -373,6 +371,7 @@
</t>
<t t-name="WebClient">
<div class="openerp openerp_webclient_container">
<table class="oe_webclient">
<tr>
<td colspan="2" class="oe_topbar">
@ -396,21 +395,29 @@
</td>
</tr>
</table>
</div>
</t>
<t t-name="EmbedClient">
<div class="openerp">
<div class="oe_application"></div>
</div>
</t>
<t t-name="ViewManager">
<div class="oe_view_manager">
<table class="oe_view_manager_header">
<col width="33%"/>
<col width="33%"/>
<col width="34%"/>
<tr class="oe_header_row">
<col width="20%"/>
<col width="25%"/>
<col width="20%"/>
<col width="35%"/>
<tr class="oe_header_row oe_header_row_top">
<td colspan="2">
<h2 class="oe_view_title" t-if="widget.flags.display_title !== false">
<span class="oe_view_title_text"><t t-esc="widget.display_title()"/></span>
<span class="oe_view_title_text oe_breadcrumb_title"/>
</h2>
</td>
<td>
<td colspan="2">
<div class="oe_view_manager_view_search" t-opentag="true"/>
</td>
</tr>
@ -418,13 +425,13 @@
<td>
<div class="oe_view_manager_buttons"/>
</td>
<td>
<td colspan="2">
<div class="oe_view_manager_sidebar"/>
</td>
<td>
<ul class="oe_view_manager_switch oe_button_group oe_right">
<t t-if="widget.views_src.length > 2" t-foreach="widget.views_src" t-as="view">
<li t-if="view.view_type != 'form'" class="oe_e"><a t-attf-class="oe_vm_switch_#{view.view_type}" t-att-data-view-type="view.view_type" t-att-title="_t('Switch to ') + (view.label || view.view_type)">
<t t-if="widget.views_src.length > 1" t-foreach="widget.views_src" t-as="view">
<li class="oe_e"><a t-attf-class="oe_vm_switch_#{view.view_type}" t-att-data-view-type="view.view_type" t-att-title="_t('Switch to ') + (view.label || view.view_type)">
</a></li>
</t>
</ul>
@ -433,7 +440,6 @@
</tr>
</table>
<div class="oe_view_manager_body">
<t t-foreach="widget.views_src" t-as="view">
<div t-attf-class="oe_view_manager_view_#{view.view_type}"/>
@ -511,65 +517,43 @@
<div class="oe_sidebar">
<t t-foreach="widget.sections" t-as="section">
<div class="oe_form_dropdown_section">
<button class="oe_dropdown_toggle"><t t-esc="section.label"/></button>
<ul class="oe_dropdown_menu">
<li t-foreach="widget.items[section.name]" t-as="item" t-att-class="item.classname">
<a class="oe_sidebar_action_a" t-att-title="item.title" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
<t t-raw="item.label"/>
</a>
</li>
<li t-if="section.name == 'files'" class="oe_sidebar_add" style="display:none;">
Input type file stuff
</li>
</ul>
<button class="oe_dropdown_toggle oe_dropdown_arrow">
<t t-esc="section.label"/>
<ul class="oe_dropdown_menu">
<li t-foreach="widget.items[section.name]" t-as="item" t-att-class="item.classname">
<a class="oe_sidebar_action_a" t-att-title="item.title" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
<t t-raw="item.label"/>
</a>
<a t-if="section.name == 'files'" class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a>
</li>
<li t-if="section.name == 'files'" class="oe_sidebar_add_attachment">
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_action">/web/binary/upload_attachment</t>
<input type="hidden" name="model" t-att-value="widget.dataset and widget.dataset.model"/>
<input type="hidden" name="id" t-att-value="widget.model_id"/>
<input type="hidden" name="session_id" t-att-value="widget.session.session_id"/>
<span>Add...</span>
</t>
</li>
</ul>
</button>
</div>
</t>
</div>
</t>
<t t-name="Sidebar.attachments">
<div class="oe-sidebar-attachments-toolbar">
<div class="oe-binary-file-set" style="float: right">
<form class="oe-binary-form" t-attf-target="#{element_id}_iframe"
method="post" enctype="multipart/form-data" action="/web/binary/upload_attachment">
<input type="hidden" name="session_id" t-att-value="session.session_id"/>
<input type="hidden" name="callback" t-attf-value="#{element_id}_iframe"/>
<input type="hidden" name="model" t-att-value="view.dataset.model"/>
<input type="hidden" name="id" t-att-value="view.datarecord.id"/>
<button class="oe_button" type="button">
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16" style="display: none"/>
<span>Add</span>
</button>
<input type="file" class="oe-binary-file" name="ufile" title="Add attachment"
t-att-onclick="view.datarecord.id ? null : 'alert(\'No record selected ! You can only attach to existing record.\'); return false;'"/>
</form>
<iframe t-attf-id="#{element_id}_iframe" t-attf-name="#{element_id}_iframe" style="display: none"/>
</div>
</div>
<br style="clear: both"/>
<ul class="oe-sidebar-attachments-items">
<li t-foreach="attachments" t-as="attachment">
<t t-if="attachment.type == 'binary'" t-set="attachment.url" t-value="_s + '/web/binary/saveas?session_id='
+ session.session_id + '&amp;model=ir.attachment&amp;id=' + attachment.id
+ '&amp;field=datas&amp;filename_field=name&amp;t=' + (new Date().getTime())"/>
<a class="oe-sidebar-attachments-link" t-att-href="attachment.url" target="_blank">
<t t-esc="attachment.name"/>
</a>
<a href="#" class="oe-sidebar-attachment-delete" t-att-data-id="attachment.id" t-attf-title="Delete the attachment #{attachment.name}">
<img t-att-src='_s + "/web/static/src/img/attachments-close.png"' width="15" height="15" border="0"/>
</a>
</li>
</ul>
</t>
<t t-name="TreeView">
<select t-if="toolbar" style="width: 30%">
</select>
<div class = "tree_header">
<select t-if="toolbar" ></select>
<button id = "tree_view_collapse">Collapse All</button>
<button id = "tree_view_expand">Expand All</button>
</div>
<table class="oe-treeview-table">
<thead>
<tr>
<th t-foreach="fields_view" t-as="field"
t-if="!field.attrs.modifiers.tree_invisible"
class="treeview-header">
t-if="!field.attrs.modifiers.tree_invisible">
<t t-esc="fields[field.attrs.name].string" />
</th>
</tr>
@ -581,11 +565,11 @@
<tr t-name="TreeView.rows"
t-foreach="records" t-as="record"
t-att-id="'treerow_' + record.id"
t-att-data-id="record.id" t-att-data-level="level + 1">
t-att-data-id="record.id" t-att-data-level="level">
<t t-set="children" t-value="record[children_field]"/>
<t t-set="class" t-value="children and children.length ? 'treeview-tr' : 'treeview-td'"/>
<t t-set="rank" t-value="'oe-treeview-first'"/>
<t t-set="style" t-value="'background-position: ' + 19*level + 'px; padding-left: ' + 19*level + 'px;'"/>
<t t-set="style" t-value="'background-position: ' + 19*(level-1) + 'px; padding-left: ' + 19*(level-1) + 'px;'"/>
<td t-foreach="fields_view" t-as="field"
t-if="!field.attrs.modifiers.tree_invisible"
@ -603,7 +587,7 @@
</td>
</tr>
<table t-name="ListView" class="oe-listview-content">
<table t-name="ListView" class="oe_list_content">
<t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0)"/>
<thead>
<tr t-if="(!!options.action_buttons and !options.$buttons) or (!!options.pager and !options.$pager)">
@ -613,18 +597,18 @@
<div class="oe_list_pager"/>
</th>
</tr>
<tr t-if="options.header" class="oe-listview-header-columns">
<tr t-if="options.header" class="oe_list_header_columns">
<t t-foreach="columns" t-as="column">
<th t-if="column.meta">
<t t-esc="column.string"/>
</th>
</t>
<th t-if="options.selectable" width="1" >
<input type="checkbox" class="all-record-selector"/>
<input type="checkbox" class="oe_list_record_selector"/>
</th>
<t t-foreach="columns" t-as="column">
<th t-if="!column.meta and column.invisible !== '1'" t-att-data-id="column.id"
t-att-class="((options.sortable and column.tag !== 'button') ? 'oe-sortable' : null)">
t-att-class="((options.sortable and column.tag !== 'button') ? 'oe_sortable' : null)">
<t t-if="column.tag !== 'button'"><t t-esc="column.string"/></t>
</th>
</t>
@ -634,7 +618,7 @@
<tfoot>
<tr>
<td t-if="options.selectable"/>
<td t-foreach="aggregate_columns" t-as="column" class="oe-list-footer oe_number"
<td t-foreach="aggregate_columns" t-as="column" class="oe_list_footer oe_number"
t-att-data-field="column.id" t-att-title="column.label">
</td>
<td t-if="options.deletable"/>
@ -642,17 +626,19 @@
</tfoot>
</table>
<div t-name="ListView.buttons" class="oe_list_buttons">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false">
<button type="button" class="oe_button oe_list_add oe_form_button_hi" t-if="widget.options.addable">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable">
<button type="button" class="oe_button oe_list_add oe_highlight">
<t t-esc="widget.options.addable"/>
</button>
<span class="oe_fade">or</span> <a href="#" class="oe_bold oe_list_button_import">Import</a>
<t t-if="widget.options.import_enabled">
<span class="oe_fade">or</span> <a href="#" class="oe_bold oe_list_button_import">Import</a>
</t>
</t>
</div>
<t t-name="ListView.pager">
<div class="oe_list_pager" t-att-colspan="widget.columns_count">
<t t-if="!widget.no_leaf and widget.options.pager !== false" t-call="ViewPager">
<span class="oe-pager-state">
<span class="oe_list_pager_state">
</span>
</t>
</div>
@ -671,7 +657,7 @@
</td>
</t>
<th t-if="options.selectable" class="oe-record-selector" width="1">
<th t-if="options.selectable" class="oe_list_record_selector" width="1">
<t t-set="checked" t-value="options.select_view_id == record.get('id') ? 'checked' : null"/>
<input t-if="options.radio" type="radio" name="radiogroup" t-att-checked="checked"/>
<input t-if="!options.radio" type="checkbox" name="radiogroup" t-att-checked="checked"/>
@ -679,20 +665,20 @@
<t t-foreach="columns" t-as="column">
<t t-set="align" t-value="column.type === 'integer' or column.type == 'float'"/>
<td t-if="!column.meta and column.invisible !== '1'" t-att-title="column.help"
t-att-class="'oe-field-cell' + (align ? ' oe_number' : '')
+ (column.tag === 'button' ? ' oe-button' : '')"
t-att-class="'oe_list_field_cell' + (align ? ' oe_number' : '')
+ (column.tag === 'button' ? ' oe_button' : '')"
t-att-data-field="column.id">
<t t-raw="render_cell(record, column)"/>
</td>
</t>
<td t-if="options.deletable" class='oe-record-delete' width="1">
<td t-if="options.deletable" class='oe_list_record_delete' width="1">
<button type="button" name="delete" class="oe_i">d</button>
</td>
</tr>
<t t-name="ListView.row.save">
<td>
<button class='oe_i oe-edit-row-save' type='button' name='save'>S</button>
<button class='oe_i oe_list_edit_row_save' type='button' name='save'/>
</td>
</t>
@ -711,7 +697,7 @@
<button type="button" class="oe_button oe_form_button_create">Create</button>
</span>
<span class="oe_form_buttons_edit">
<button type="button" class="oe_button oe_form_button_save">Save</button> <span class="oe_fade">or</span> <a href="#" class="oe_bold oe_form_button_cancel">Discard</a>
<button type="button" class="oe_button oe_form_button_save oe_highlight">Save</button> <span class="oe_fade">or</span> <a href="#" class="oe_bold oe_form_button_cancel">Discard</a>
</span>
</t>
</div>
@ -791,11 +777,11 @@
</t>
<t t-name="FormRenderingGroup">
<t t-if="string" t-call="FormRenderingSeparator"/>
<table border="0" cellpadding="0" cellspacing="0" width="100%" t-attf-class="oe_form_group #{classnames}"/>
<table border="0" cellpadding="0" cellspacing="0" t-attf-class="oe_form_group #{classnames}"/>
</t>
<t t-name="FormRenderingNotebook">
<div>
<ul t-attf-class="oe_form_notebook #{classnames}">
<div class="oe_clear">
<ul t-attf-class="oe_notebook #{classnames}">
<li t-foreach="pages" t-as="page" t-att-modifiers="page.modifiers">
<a t-attf-href="##{page.id}">
<t t-esc="page.string"/>
@ -805,11 +791,11 @@
</div>
</t>
<t t-name="FormRenderingNotebookPage">
<div t-attf-class="oe_form_notebook_page #{classnames}" t-att-id="id">
<div t-attf-class="oe_notebook_page #{classnames}" t-att-id="id">
</div>
</t>
<t t-name="FormRenderingSeparator">
<div t-attf-class="oe_horizontal_separator #{classnames}">
<div t-attf-class="oe_horizontal_separator oe_clear #{classnames}">
<t t-esc="string"/>
</div>
</t>
@ -888,7 +874,7 @@
</ul>
</t>
<t t-name="FieldChar">
<span t-att-class="'oe_form_field '+widget.widget_class">
<span t-att-class="'oe_form_field '+widget.widget_class" t-att-style="widget.node.attrs.style">
<t t-if="!widget.get('effective_readonly')">
<input t-att-type="widget.password ? 'password' : 'text'"
t-att-id="widget.id_for_label"
@ -900,12 +886,9 @@
</span>
</t>
<t t-name="FieldEmail">
<span class="oe_form_field oe_form_field_email oe_form_field_with_button">
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri"/>
<span class="oe_form_field oe_form_field_email" t-att-style="widget.node.attrs.style">
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri" target="_blank"/>
<t t-if="!widget.get('effective_readonly')">
<button class="oe_button" tabindex="-1" type="button" title="Send an e-mail with your default e-mail client">
<img t-att-src='_s + "/web/static/src/img/icons/terp-mail-message-new.png"'/>
</button>
<div>
<input type="text"
t-att-id="widget.id_for_label"
@ -921,20 +904,15 @@
<t t-jquery="span:first">
this.removeClass('oe_form_field_email').addClass('oe_form_field_url');
</t>
<t t-jquery="button.oe_button" t-operation="replace">
<button class="oe_button" tabindex="-1" type="button" title="Open this resource">
<img t-att-src='_s + "/web/static/src/img/icons/gtk-ok.png"'/>
</button>
</t>
</t>
<t t-name="FieldText">
<div class="oe_form_field oe_form_field_text">
<div class="oe_form_field oe_form_field_text" t-att-style="widget.node.attrs.style">
<textarea rows="6"
t-att-name="widget.name"
class="field_text"
t-att-tabindex="widget.node.attrs.tabindex"
t-att-autofocus="widget.node.attrs.autofocus"
t-att-placeholder="widget.node.attrs.placeholder"
t-att-placeholder="! widget.get('effective_readonly') ? widget.node.attrs.placeholder : ''"
></textarea>
<img class="oe_field_translate oe_input_icon" t-if="widget.field.translate"
t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/>
@ -953,13 +931,13 @@
</span>
</t>
<t t-name="FieldDate">
<span class="oe_form_field oe_datepicker_root oe_form_field_date"/>
<span class="oe_form_field oe_datepicker_root oe_form_field_date" t-att-style="widget.node.attrs.style"/>
</t>
<t t-name="FieldDatetime">
<span class="oe_form_field oe_datepicker_root oe_form_field_datetime"/>
<span class="oe_form_field oe_datepicker_root oe_form_field_datetime" t-att-style="widget.node.attrs.style"/>
</t>
<t t-name="FieldSelection">
<span class="oe_form_field oe_form_field_selection">
<span class="oe_form_field oe_form_field_selection" t-att-style="widget.node.attrs.style">
<select t-if="!widget.get('effective_readonly')"
t-att-name="widget.name"
t-att-tabindex="widget.node.attrs.tabindex"
@ -972,12 +950,13 @@
</span>
</t>
<t t-name="FieldMany2One">
<span class="oe_form_field oe_form_field_many2one oe_form_field_with_button">
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri"/>
<span class="oe_form_field oe_form_field_many2one oe_form_field_with_button" t-att-style="widget.node.attrs.style">
<t t-if="widget.get('effective_readonly')">
<a href="#" class="oe_form_uri"/>
<span class="oe_form_m2o_follow"/>
</t>
<t t-if="!widget.get('effective_readonly')">
<button class="oe_button oe-m2o-cm-button" title="Open Resource">
<img t-att-src='_s + "/web/static/src/img/icons/terp-folder-yellow.png"'/>
</button>
<a href="#" class="oe_m2o_cm_button oe_e oe_right">/</a>
<div>
<input type="text"
t-att-id="widget.id_for_label"
@ -985,31 +964,34 @@
t-att-autofocus="widget.node.attrs.autofocus"
t-att-placeholder="widget.node.attrs.placeholder"
/>
<span class="oe-m2o-drop-down-button">
<span class="oe_m2o_drop_down_button">
<img t-att-src='_s + "/web/static/src/img/down-arrow.png"'/>
</span>
</div>
</t>
</span>
</t>
<!-- Collection of m2m tags -->
<t t-name="FieldMany2ManyTags">
<div class="oe_form_field oe_form_field_many2manytags">
<div class="oe_form_field oe_tags" t-att-style="widget.node.attrs.style">
<t t-if="! widget.get('effective_readonly')">
<textarea rows="1" style="width: 100%"></textarea>
<textarea rows="1" style="width: 100%"
t-att-placeholder="widget.node.attrs.placeholder"></textarea>
</t>
</div>
</t>
<t t-name="FieldMany2ManyTags.box">
<!-- Individual m2m tag element -->
<t t-name="FieldMany2ManyTag">
<t t-set="i" t-value="0"/>
<t t-foreach="elements" t-as="el">
<span class="oe_form_field_many2manytags_box" t-att-data-index="i">
<span class="oe_tag" t-att-data-index="i">
<t t-esc="el[1]"/>
</span>
<t t-set="i" t-value="i + 1"/>
</t>
</t>
<t t-name="FieldReference">
<table class="oe_form_field oe_form_field_reference oe_form" border="0" cellpadding="0" cellspacing="0">
<table class="oe_form_field oe_form_field_reference" border="0" cellpadding="0" cellspacing="0" t-att-style="widget.node.attrs.style">
<tr>
<td t-attf-class="oe_form_frame_cell oe_form_selection">
<span t-attf-class="oe_form_view_reference_selection"/>
@ -1021,7 +1003,7 @@
</table>
</t>
<t t-name="FieldBoolean">
<span class="oe_form_field oe_form_field_boolean">
<span class="oe_form_field oe_form_field_boolean" t-att-style="widget.node.attrs.style">
<input type="checkbox"
t-att-id="widget.id_for_label"
t-att-name="widget.name"
@ -1031,47 +1013,38 @@
</span>
</t>
<t t-name="FieldProgressBar">
<span class="oe_form_field oe_form_field_progressbar" t-opentag="true">
<span class="oe_form_field oe_form_field_progressbar" t-att-style="widget.node.attrs.style">
<span></span>
</span>
</t>
<t t-name="FieldStatus">
<ul class="oe_form_steps" t-att-style="widget.node.attrs.style"/>
</t>
<t t-name="FieldStatus.content">
<ul class="oe_form_steps">
<t t-set="size" t-value="widget.to_show.length"/>
<t t-foreach="_.range(size)" t-as="i">
<li t-att-class="widget.to_show[i][0] === widget.selected_value ? 'oe_form_steps_active' : ''">
<span><t t-esc="widget.to_show[i][1]"/></span>
<img t-att-src='_s + "/web/static/src/img/form_steps.png"' class="oe_form_steps_arrow" t-if="i &lt; size - 1"/>
</li>
</t>
</ul>
<div class="oe_clear"/>
<t t-set="size" t-value="widget.to_show.length"/>
<t t-foreach="_.range(size)" t-as="i">
<li t-att-class="widget.to_show[i][0] === widget.selected_value ? 'oe_form_steps_active' : ''">
<span><t t-esc="widget.to_show[i][1]"/></span>
<img t-att-src='_s + "/web/static/src/img/form_steps.png"' class="oe_form_steps_arrow" t-if="i &lt; size - 1"/>
</li>
</t>
</t>
<t t-name="FieldBinaryImage">
<span class="oe_form_field oe_form_field_image">
<div class="oe_form_field_image_controls oe_form_readonly_hidden">
<div class="oe-binary-file-set">
<form class="oe-binary-form" t-att-target="widget.iframe"
method="post" enctype="multipart/form-data" action="/web/binary/upload">
<input type="hidden" name="session_id" value=""/>
<input type="hidden" name="callback" t-att-value="widget.iframe"/>
<button class="oe_button" type="button" title="Set Image">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
</button>
<input type="file" class="oe-binary-file" name="ufile"
t-att-tabindex="widget.node.attrs.tabindex"
t-att-autofocus="widget.node.attrs.autofocus"
/>
</form>
</div>
<button class="oe_button oe-binary-file-clear" type="button" title="Clear">
<span class="oe_form_field oe_form_field_image" t-att-style="widget.node.attrs.style">
<div class="oe_form_field_image_controls oe_edit_only">
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<button class="oe_button" type="button" title="Set Image">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
</button>
</t>
<button class="oe_button oe_form_binary_file_clear" type="button" title="Clear">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_MISSING_IMAGE.png"'/>
</button>
<div class="oe-binary-progress" style="display: none">
<div class="oe_form_binary_progress" style="display: none">
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/>
<b>Uploading ...</b>
</div>
<iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"/>
</div>
</span>
</t>
@ -1085,7 +1058,7 @@
</t>
<t t-name="FieldBinaryFile">
<t t-if="!widget.get('effective_readonly')">
<table class="oe_form_field oe_form_field_binary" cellpadding="0" cellspacing="0" border="0">
<table class="oe_form_field oe_form_field_binary" cellpadding="0" cellspacing="0" border="0" t-att-style="widget.node.attrs.style">
<tr>
<td>
<input type="text" size="1" readonly="readonly"
@ -1095,31 +1068,29 @@
class="field_binary"
/>
</td>
<td class="oe-binary" nowrap="true">
<td class="oe_form_binary" nowrap="true">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<div class="oe-binary-file-set" style="width: 80px; height:22px;">
<form class="oe-binary-form" t-att-target="widget.iframe"
method="post" enctype="multipart/form-data" action="/web/binary/upload">
<input type="hidden" name="session_id" value=""/>
<input type="hidden" name="callback" t-att-value="widget.iframe"/>
<button class="oe_button oe_field_button" type="button" title="Set Image">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
<span>Select</span>
</button>
<input type="file" class="oe-binary-file" name="ufile"/>
</form>
</div>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_style">width: 83px;</t>
<button class="oe_button oe_field_button" type="button" title="Set Image">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY.png"'/>
<span>Select</span>
</button>
</t>
</td>
<td>
<button class="oe_button oe-binary-file-save" type="button" title="Save As">
<img t-att-src='_s + "/web/static/src/img/icons/gtk-save.png"'/>
<span>Save As</span>
</button>
<a class="oe_form_binary_file_save_data">
<button class="oe_button oe_form_binary_file_save" type="button" title="Save As">
<img t-att-src='_s + "/web/static/src/img/icons/gtk-save.png"'/>
<span>Save As</span>
</button>
</a>
</td>
<td>
<button class="oe_button oe-binary-file-clear" type="button" title="Clear">
<button class="oe_button oe_form_binary_file_clear" type="button" title="Clear">
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_MISSING_IMAGE.png"'/>
<span>Clear</span>
</button>
@ -1127,22 +1098,34 @@
</tr>
</table>
</td>
<td class="oe-binary-progress" style="display: none" nowrap="true">
<td class="oe_form_binary_progress" style="display: none" nowrap="true">
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/>
<b>Uploading ...</b>
<iframe t-att-id="widget.iframe" t-att-name="widget.iframe" style="display: none"/>
</td>
</tr>
</table>
</t>
<t t-if="widget.get('effective_readonly')">
<span>
<span t-att-style="widget.node.attrs.style">
<a href="javascript:void(0)" class="oe_form_uri"/>
</span>
</t>
</t>
<t t-name="HiddenInputFile">
<div t-attf-class="oe_hidden_input_file #{fileupload_class or ''}" t-att-style="fileupload_style">
<form class="oe_form_binary_form" t-att-target="fileupload_id"
method="post" enctype="multipart/form-data" t-att-action="fileupload_action || '/web/binary/upload'">
<input type="hidden" name="session_id" value=""/>
<input type="hidden" name="callback" t-att-value="fileupload_id"/>
<t t-raw="__content__"/>
<input type="file" class="oe_form_binary_file" name="ufile"/>
</form>
<iframe t-att-id="fileupload_id" t-att-name="fileupload_id" style="display: none"/>
</div>
</t>
<t t-name="WidgetButton">
<button type="button" class="oe_button oe_form_button"
t-att-style="widget.node.attrs.style"
t-att-tabindex="widget.node.attrs.tabindex"
t-att-autofocus="widget.node.attrs.autofocus">
<img t-if="widget.node.attrs.icon" t-att-src="_s + '/web/static/src/img/icons/' + widget.node.attrs.icon + '.png'" width="16" height="16"/>
@ -1204,8 +1187,6 @@
</t>
<t t-name="One2Many.viewmanager" t-extend="ViewManager">
<t t-jquery="span.oe_view_title_text" t-operation="replace"/>
<t t-jquery=".oe-view-manager-header">
this.attr('t-if', 'views.length != 1');
</t>
@ -1233,7 +1214,7 @@
<div t-name="SearchView" class="oe_searchview">
<div class="oe_searchview_facets"/>
<div class="oe_searchview_clear"/>
<div class="oe_searchview_unfold_drawer"/>
<div class="oe_searchview_unfold_drawer" title="Advanced Search..."/>
<div class="oe_searchview_drawer"/>
</div>
@ -1257,7 +1238,7 @@
</span>
<t t-name="SearchView.managed-filters">
<option class="oe-filters-title" value="">Filters</option>
<option class="oe_search_filters_title" value="">Filters</option>
<optgroup label="-- Filters --">
<t t-foreach="filters" t-as="filter">
<option t-attf-value="get:#{filter_index}"
@ -1270,7 +1251,6 @@
<optgroup label="-- Actions --">
<option value="advanced_filter">Add Advanced Filter</option>
<option value="save_filter">Save Filter</option>
<option value="add_to_dashboard">Add to Dashboard</option>
<option value="manage_filters">Manage Filters</option>
</optgroup>
</t>
@ -1281,18 +1261,9 @@
<p>(Any existing filter with the same name will be replaced)</p>
</div>
</t>
<t t-name="SearchView.add_to_dashboard">
<div class="oe_form">
<p><b>Select Dashboard to add this filter to:</b></p>
<select style="width: 100%; margin-right: 1em;">
<option t-foreach="dashboards" t-as="menu" t-att-value="menu.id" t-att-selected="(menu.id == selected_menu_id) || undefined"><t t-esc="menu.name"/></option>
</select>
<p><b>Title of new Dashboard item:</b></p>
<input type="text" style="width: 100%; margin-right: 1em;"/>
</div>
</t>
<t t-name="SearchView.render_lines">
<table class="oe-searchview-render-line" border="0" cellspacing="0" cellpadding="0"
<table class="oe_search_render_line" border="0" cellspacing="0" cellpadding="0"
t-foreach="lines" t-as="line">
<tr>
<td t-foreach="line" t-as="widget" class="oe_searchview_field">
@ -1429,6 +1400,20 @@
<div>
</div>
</div>
<div t-name="SearchView.addtodashboard" class="oe_searchview_dashboard">
<h4>Add to Dashboard</h4>
<form>
<input placeholder ="Title of new Dashboard item" title = "Title of new Dashboard item" type="text"/>
<button class="oe_apply" type="submit">save</button>
</form>
</div>
<t t-name="SearchView.addtodashboard.selection">
<select title = "Select Dashboard to add this filter to">
<t t-foreach="selections" t-as="element">
<option t-att-value="element.id || element.res_id "><t t-esc="element.name"/></option>
</t>
</select>
</t>
<div t-name="SearchView.advanced" class="oe_searchview_advanced">
<h4>Advanced Search</h4>
<form>
@ -1443,8 +1428,7 @@
<li>
<select class="searchview_extended_prop_field">
<t t-foreach="widget.attrs.fields" t-as="field">
<option t-if="typeof field.store === 'undefined' || field.store || field.fnct_search"
t-att="{'selected': field === widget.attrs.selected ? 'selected' : null}"
<option t-att="{'selected': field === widget.attrs.selected ? 'selected' : null}"
t-att-value="field.name">
<t t-esc="field.string"/>
</option>
@ -1479,31 +1463,34 @@
<table style="width:100%">
<tr style="width:100%">
<td style="width:100%">
<div class="oe-select-create-popup-view-search" style="width:100%"></div>
<div class="oe_popup_search" style="width:100%"></div>
</td>
</tr>
<tr style="width:100%">
<td style="width:100%">
<div class="oe-select-create-popup-view-list" style="width:100%"></div>
<div class="oe_popup_list" style="width:100%"></div>
</td>
</tr>
</table>
<div class="oe-form-view-popup-form-placeholder oe-select-create-popup-view-form" style="width:100%"></div>
<div class="oe_popup_form" style="width:100%"></div>
</div>
</t>
<t t-name="SelectCreatePopup.search.buttons">
<button type="button" class="oe_button oe_selectcreatepopup-search-select" disabled="disabled">Select</button>
<button type="button" class="oe_button oe_selectcreatepopup-search-close">Cancel</button>
<t t-if="! widget.options.disable_multiple_selection">
<button type="button" class="oe_button oe_selectcreatepopup-search-select" disabled="disabled">Select</button>
or
</t>
<a class="oe_button oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a>
</t>
<t t-name="AbstractFormPopup.buttons">
<t t-if="! multi_select">
<button type="button" class="oe_button oe_abstractformpopup-form-save">Save</button>
<button type="button" class="oe_button oe_abstractformpopup-form-save oe_highlight">Save</button>
</t>
<t t-if="multi_select">
<button type="button" class="oe_button oe_abstractformpopup-form-save-new">Save &amp; New</button>
<button type="button" class="oe_button oe_abstractformpopup-form-save">Save &amp; Close</button>
<button type="button" class="oe_button oe_abstractformpopup-form-save-new oe_highlight">Save &amp; New</button>
<button type="button" class="oe_button oe_abstractformpopup-form-save oe_highlight">Save &amp; Close</button>
</t>
<button type="button" class="oe_button oe_abstractformpopup-form-close">Cancel</button>
or <a class="oe_button oe_abstractformpopup-form-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a>
</t>
<t t-extend="ListView.row">
<!-- adds back padding to row being rendered after edition, if necessary
@ -1511,7 +1498,7 @@
missing columns
-->
<t t-jquery="&gt; :last" t-operation="after">
<td t-if="edited and !options.deletable" class="oe-listview-padding"/>
<td t-if="edited and !options.deletable" class="oe_list_padding"/>
</t>
</t>
@ -1527,7 +1514,7 @@
<tr>
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
<img t-if="rec.child_id.length" t-att-id="'parentimg-' + rec.id"
src="/web/static/src/img/collapse.gif" width="16" height="16" border="0"/>
t-att-src='_s + "/web/static/src/img/collapse.gif"' width="16" height="16" border="0"/>
</td>
<td style="cursor: pointer;">
<a style="text-decoration:none" href="javascript:void(0);">
@ -1539,22 +1526,22 @@
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-add" src="/web/static/src/img/icons/gtk-add.png" style="cursor: pointer;"/>
id="side-add" t-att-src='_s + "/web/static/src/img/icons/gtk-add.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img id="side-remove" src="/web/static/src/img/icons/gtk-remove.png" style="cursor: pointer;"/>
<img id="side-remove" t-att-src='_s + "/web/static/src/img/icons/gtk-remove.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length and !_.include(no_properties, rec.att_list[0])"
id="side-edit" src="/web/static/src/img/icons/gtk-edit.png" style="cursor: pointer;"/>
id="side-edit" t-att-src='_s + "/web/static/src/img/icons/gtk-edit.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-up" src="/web/static/src/img/icons/gtk-go-up.png" style="cursor: pointer;"/>
id="side-up" t-att-src='_s + "/web/static/src/img/icons/gtk-go-up.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-down" src="/web/static/src/img/icons/gtk-go-down.png" style="cursor: pointer;"/>
id="side-down" t-att-src='_s + "/web/static/src/img/icons/gtk-go-down.png"' style="cursor: pointer;"/>
</td>
<t t-if="rec.child_id.length">
<t t-set="data" t-value="rec.child_id"/>
@ -1578,11 +1565,10 @@
<t t-name="vieweditor_boolean">
<input type="checkbox" t-att-id="widget.name"/>
</t>
<t t-name="ExportView">
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
</t>
<table t-name="ExportTreeView" class="oe-export"
<table t-name="ExportTreeView" class="oe_export"
style="background-color: #F3F3F3;">
<tr>
<td colspan="3">
@ -1687,7 +1673,7 @@
</t>
<t t-name="ImportDataView">
<form name="import_data" id="import_data" action="" method="post" enctype="multipart/form-data"
class="oe-import oe-import-no-result">
class="oe_import oe_import_no_result">
<input type="hidden" name="session_id" t-att-value="widget.session.session_id"/>
<h2 class="separator horizontal">1. Import a .CSV file</h2>
<p>Select a .CSV file to import. If you need a sample of file to import,
@ -1697,9 +1683,9 @@
<label for="csvfile">CSV File:</label>
<input type="file" id="csvfile" size="50" name="csvfile"/>
</p>
<h2 class="separator horizontal oe-import-result">2. Check your file format</h2>
<div id="result" class="oe-import-result"></div>
<fieldset class="oe-closed oe-import-result">
<h2 class="separator horizontal oe_import_result">2. Check your file format</h2>
<div id="result" class="oe_import_result"></div>
<fieldset class="oe_closed oe_import_result">
<legend>Import Options</legend>
<table>
<tr>
@ -1739,7 +1725,7 @@
</tr>
<tr>
<td t-foreach="records[0]" t-as="column">
<input class="sel_fields" placeholder="--- Don't Import ---"/><span class="oe-m2o-drop-down-button">
<input class="sel_fields" placeholder="--- Don't Import ---"/><span class="oe_m2o_drop_down_button">
<img t-att-src='_s + "/web/static/src/img/down-arrow.png"' /></span>
</td>
</tr>

View File

@ -843,6 +843,25 @@ $(document).ready(function () {
deepEqual(f.get_domain(facet), [['foo', '=', 42]],
"m2o should use identity if default domain");
deepEqual(f.get_context(facet), {default_foo: 42},
"m2o should use value as context default");
});
test("M2O default multiple values", function () {
var f = new instance.web.search.ManyToOneField(
{}, {name: 'foo'}, {inputs: []});
var facet = new instance.web.search.Facet({
field: f,
values: [
{label: "Foo", value: 42},
{label: "Bar", value: 36}
]
});
deepEqual(f.get_domain(facet).__domains,
[['|'], [['foo', '=', 42]], [['foo', '=', 36]]],
"m2o should or multiple values");
equal(f.get_context(facet), null,
"m2o should not have default context in case of multiple values");
});
test("M2O custom operator", function () {
var f = new instance.web.search.ManyToOneField(
@ -854,6 +873,8 @@ $(document).ready(function () {
deepEqual(f.get_domain(facet), [['foo', 'boos', 'Foo']],
"m2o should use label with custom operators");
deepEqual(f.get_context(facet), {default_foo: 42},
"m2o should use value as context default");
});
test("M2O custom domain & context", function () {
var f = new instance.web.search.ManyToOneField({attrs: {
@ -1094,6 +1115,72 @@ $(document).ready(function () {
});
});
module('saved_filters', {
setup: function () {
instance = window.openerp.init([]);
window.openerp.web.corelib(instance);
window.openerp.web.coresetup(instance);
window.openerp.web.chrome(instance);
window.openerp.web.data(instance);
window.openerp.web.formats(instance);
window.openerp.web.search(instance);
instance.web.qweb.add_template(doc);
mockifyRPC(instance.connection);
}
});
asyncTest('checkboxing', 6, function () {
var view = makeSearchView();
instance.connection.responses['/web/searchview/get_filters'] = function () {
return {result: [{
name: "filter name",
user_id: 42
}]};
};
var $fix = $('#qunit-fixture');
view.appendTo($fix)
.always(start)
.fail(function (error) { ok(false, error.message); })
.done(function () {
var $row = $fix.find('.oe_searchview_custom li:first').click();
ok($row.hasClass('oe_selected'), "should check/select the filter's row");
ok($row.hasClass("oe_searchview_custom_private"),
"should have private filter note/class");
equal(view.query.length, 1, "should have only one facet");
var values = view.query.at(0).values;
equal(values.length, 1,
"should have only one value in the facet");
equal(values.at(0).get('label'), 'filter name',
"displayed label should be the name of the filter");
equal(values.at(0).get('value'), null,
"should have no value set");
})
});
asyncTest('removal', 1, function () {
var view = makeSearchView();
instance.connection.responses['/web/searchview/get_filters'] = function () {
return {result: [{
name: "filter name",
user_id: 42
}]};
};
var $fix = $('#qunit-fixture');
view.appendTo($fix)
.always(start)
.fail(function (error) { ok(false, error.message); })
.done(function () {
var $row = $fix.find('.oe_searchview_custom li:first').click();
view.query.remove(view.query.at(0));
ok(!$row.hasClass('oe_selected'),
"should not be checked anymore");
})
});
module('advanced', {
setup: function () {
instance = window.openerp.init([]);

View File

@ -1,9 +1,9 @@
{
"name": "web calendar",
"name": "Web Calendar",
"category": "Hidden",
"description":
"""
OpenERP Web calendar view.
OpenERP Web Calendar view.
""",
"version": "2.0",
"depends": ['web'],

View File

@ -7,35 +7,138 @@ msgid ""
msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-06 17:33+0100\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-01-08 20:21+0000\n"
"Last-Translator: kifcaliph <Unknown>\n"
"Language-Team: Arabic <ar@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-06-01 05:37+0000\n"
"X-Generator: Launchpad (build 15342)\n"
"X-Launchpad-Export-Date: 2012-07-03 05:55+0000\n"
"X-Generator: Launchpad (build 15531)\n"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:11
#: addons/web_calendar/static/src/js/calendar.js:12
msgid "Calendar"
msgstr "التقويم"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:466
#: addons/web_calendar/static/src/js/calendar.js:467
msgid "Responsible"
msgstr "مسؤول"
#: addons/web_calendar/static/src/js/calendar.js:73
msgid "Filter"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:504
#: addons/web_calendar/static/src/js/calendar.js:505
msgid "Navigator"
msgstr "المتصفح"
#: addons/web_calendar/static/src/js/calendar.js:139
msgid "Today"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:5
#: addons/web_calendar/static/src/xml/web_calendar.xml:6
#: addons/web_calendar/static/src/js/calendar.js:140
msgid "Day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:141
msgid "Week"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:142
msgid "Month"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:143
msgid "New event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:144
msgid "Save"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:145
msgid "Cancel"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:146
msgid "Details"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:147
msgid "Edit"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:148
msgid "Delete"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:150
msgid "Event will be deleted permanently, are you sure?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:151
#: addons/web_calendar/static/src/js/calendar.js:164
msgid "Description"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:152
msgid "Time period"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:153
msgid "Full day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:156
msgid "Do you want to edit the whole set of repeated events?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:157
msgid "Repeat event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:158
msgid "Disabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:159
msgid "Enabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:162
#: addons/web_calendar/static/src/js/calendar.js:170
msgid "Agenda"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:163
msgid "Date"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:167
msgid "Year"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:8
#: addons/web_calendar/static/src/xml/web_calendar.xml:9
msgid "&nbsp;"
msgstr "&nbsp;"
#~ msgid "Navigator"
#~ msgstr "المتصفح"

View File

@ -7,35 +7,138 @@ msgid ""
msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-06 17:33+0100\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-05-16 09:33+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Bulgarian <bg@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-06-01 05:37+0000\n"
"X-Generator: Launchpad (build 15342)\n"
"X-Launchpad-Export-Date: 2012-07-03 05:55+0000\n"
"X-Generator: Launchpad (build 15531)\n"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:11
#: addons/web_calendar/static/src/js/calendar.js:12
msgid "Calendar"
msgstr "Календар"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:466
#: addons/web_calendar/static/src/js/calendar.js:467
msgid "Responsible"
msgstr "Отговорник"
#: addons/web_calendar/static/src/js/calendar.js:73
msgid "Filter"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:504
#: addons/web_calendar/static/src/js/calendar.js:505
msgid "Navigator"
msgstr "Навигатор"
#: addons/web_calendar/static/src/js/calendar.js:139
msgid "Today"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:5
#: addons/web_calendar/static/src/xml/web_calendar.xml:6
#: addons/web_calendar/static/src/js/calendar.js:140
msgid "Day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:141
msgid "Week"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:142
msgid "Month"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:143
msgid "New event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:144
msgid "Save"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:145
msgid "Cancel"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:146
msgid "Details"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:147
msgid "Edit"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:148
msgid "Delete"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:150
msgid "Event will be deleted permanently, are you sure?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:151
#: addons/web_calendar/static/src/js/calendar.js:164
msgid "Description"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:152
msgid "Time period"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:153
msgid "Full day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:156
msgid "Do you want to edit the whole set of repeated events?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:157
msgid "Repeat event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:158
msgid "Disabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:159
msgid "Enabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:162
#: addons/web_calendar/static/src/js/calendar.js:170
msgid "Agenda"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:163
msgid "Date"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:167
msgid "Year"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:8
#: addons/web_calendar/static/src/xml/web_calendar.xml:9
msgid "&nbsp;"
msgstr ""
#~ msgid "Navigator"
#~ msgstr "Навигатор"

View File

@ -7,35 +7,138 @@ msgid ""
msgstr ""
"Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-06 17:33+0100\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2011-11-24 12:51+0000\n"
"Last-Translator: nasir khan saikat <nasir8891@gmail.com>\n"
"Language-Team: Bengali <bn@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-06-01 05:37+0000\n"
"X-Generator: Launchpad (build 15342)\n"
"X-Launchpad-Export-Date: 2012-07-03 05:55+0000\n"
"X-Generator: Launchpad (build 15531)\n"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:11
#: addons/web_calendar/static/src/js/calendar.js:12
msgid "Calendar"
msgstr "পুঞ্জিকা"
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:466
#: addons/web_calendar/static/src/js/calendar.js:467
msgid "Responsible"
msgstr "দায়িত্বপ্রাপ্ত"
#: addons/web_calendar/static/src/js/calendar.js:73
msgid "Filter"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:504
#: addons/web_calendar/static/src/js/calendar.js:505
msgid "Navigator"
msgstr "ভ্রমনপরিকল্পক"
#: addons/web_calendar/static/src/js/calendar.js:139
msgid "Today"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:5
#: addons/web_calendar/static/src/xml/web_calendar.xml:6
#: addons/web_calendar/static/src/js/calendar.js:140
msgid "Day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:141
msgid "Week"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:142
msgid "Month"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:143
msgid "New event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:144
msgid "Save"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:145
msgid "Cancel"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:146
msgid "Details"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:147
msgid "Edit"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:148
msgid "Delete"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:150
msgid "Event will be deleted permanently, are you sure?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:151
#: addons/web_calendar/static/src/js/calendar.js:164
msgid "Description"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:152
msgid "Time period"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:153
msgid "Full day"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:156
msgid "Do you want to edit the whole set of repeated events?"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:157
msgid "Repeat event"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:158
msgid "Disabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:159
msgid "Enabled"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:162
#: addons/web_calendar/static/src/js/calendar.js:170
msgid "Agenda"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:163
msgid "Date"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:167
msgid "Year"
msgstr ""
#. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:8
#: addons/web_calendar/static/src/xml/web_calendar.xml:9
msgid "&nbsp;"
msgstr "&nbsp;"
#~ msgid "Navigator"
#~ msgstr "ভ্রমনপরিকল্পক"

Some files were not shown because too many files have changed in this diff Show More