diff --git a/lib/galaxy/interfaces/root.py b/lib/galaxy/interfaces/root.py index 01e59c6aac3..173a761c5b9 100644 --- a/lib/galaxy/interfaces/root.py +++ b/lib/galaxy/interfaces/root.py @@ -24,14 +24,18 @@ class Universe(common.Root): @web.expose def index(self, trans, id=None, tool_id=None, mode=None, **kwd): - if mode: - trans.set_cookie(name=self.pref_cookie_name, value=mode) + # if mode: + # trans.set_cookie(name=self.pref_cookie_name, value=mode) + # else: + # mode = trans.get_cookie(name=self.pref_cookie_name) + # trans.ensure_valid_galaxy_session() + # result = trans.fill_template('index_frames.tmpl', mode=mode) + # return [ result ] + if trans.app.config.get( "new_style_june_2007", "false" ) == "true": + return trans.fill_template( "root/index.tmpl" ) else: - mode = trans.get_cookie(name=self.pref_cookie_name) - trans.ensure_valid_galaxy_session() - result = trans.fill_template('index_frames.tmpl', mode=mode) - return [ result ] - + return trans.fill_template( "index_frames.tmpl" ) + @web.expose def tool_menu( self, trans ): return trans.fill_template('tool_menu.tmpl', toolbox=self.get_toolbox() ) @@ -244,6 +248,11 @@ class Universe(common.Root): self.app.model.flush() return "OK" + @web.expose + def history_options( self, trans ): + """Displays a list of history related actions""" + return trans.fill_template( "history_options.tmpl", history = trans.get_history() ) + @web.expose def history_delete( self, trans, id = None, **kwd): """Deletes a list of histories, ensures that histories are owned by current user""" diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 34e9e1ac6c0..7eec6077937 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -258,6 +258,12 @@ class Tool: cls = action_elem.get( 'class' ) mod = __import__( module, globals(), locals(), [cls]) self.tool_action = getattr( mod, cls )() + # User interface hints + self.uihints = {} + uihints_elem = root.find( "uihints" ) + if uihints_elem is not None: + for key, value in uihints_elem.attrib.iteritems(): + self.uihints[ key ] = value # Tests tests_elem = root.find( "tests" ) if tests_elem: diff --git a/static/june_2007_style/Makefile b/static/june_2007_style/Makefile new file mode 100644 index 00000000000..448ff064b21 --- /dev/null +++ b/static/june_2007_style/Makefile @@ -0,0 +1,26 @@ +menu_bg.png : + ./gradient.py 9 1000 DDDDFF 9999FF FFFFFF 0 0 FFFFFF 1 1 > $@ + +base_bg.png : + ./gradient.py 9 1000 EEEEFF - FFFFFF 0 0 FFFFFF 1 1 > $@ + +masthead_bg.png : + ./gradient.py 9 50 023858 000000 000000 0 0.5 000000 1 1 > $@ + +footer_title_bg.png : + ./gradient.py 9 30 023858 000000 000000 0 0.5 000000 1 1 > $@ + +form_title_bg.png : + ./gradient.py 9 50 ebd9b2 b9a780 FFFFFF 0 0 FFFFFF 0.5 1 > $@ + +ok_bg.png : + ./gradient.py 9 200 AAFFAA - CCFFCC 0 0.5 CCFFCC 1 1 > $@ + +error_bg.png : + ./gradient.py 9 200 FFAAAA - FFCCCC 0 0.5 FFCCCC 1 1 > $@ + +warn_bg.png : + ./gradient.py 9 200 FFFFAA - FFFFCC 0 0.5 FFFFCC 1 1 > $@ + +gray_bg.png : + ./gradient.py 9 200 AAAAAA - CCCCCC 0 0.5 CCCCCC 1 1 > $@ diff --git a/static/june_2007_style/base.css.tmpl b/static/june_2007_style/base.css.tmpl new file mode 100644 index 00000000000..469e3d700df --- /dev/null +++ b/static/june_2007_style/base.css.tmpl @@ -0,0 +1,266 @@ +@import url( "reset.css" ); + +body +{ + font: 75% verdana, "Bitstream Vera Sans", geneva, arial, helvetica, helve, sans-serif; + background: $base_bg_bottom; + color: $base_text; + background-image: url(base_bg.png); + background-repeat: repeat-x; + background-position: top; + margin: 10px; + margin-right: 15px; + margin-left: 15px; +} + +a:link, a:visited, a:active +{ + color: $link_text; +} + +h1, h2, h3, h4 +{ + color: $header_text; + /*text-shadow: #bbb 2px 2px 1px;*/ +} + +hr +{ + border: none; + border-bottom: dotted $base_text 1px; +} + +div.toolForm +{ + border: solid $form_border 1px; +} + +div.toolFormTitle +{ + font-weight: bold; + padding: 5px; + background: $form_title_bg_bottom; + background-image: url(form_title_bg.png); + background-repeat: repeat-x; + background-position: top; + border-bottom: solid $form_border 1px; +} + +div.toolParamHelp +{ + font-style: italic; +} + +div.toolFormBody +{ + padding: 5px; + background: $form_body_bg_bottom; + background-image: url(form_body_bg.png); + background-repeat: repeat-x; + background-position: top; +} + +div.toolFormBody div.toolFormTitle +{ + background: transparent; + border: none; + font-weight: bold; + border-bottom: solid $form_border 1px; + margin-bottom: 5px; +} + +div.toolHelp +{ +} + +div.toolHelpBody +{ + width: 100%; + overflow: auto; +} + +select +{ + max-width: 300px; +} + +.errormessage, .warningmessage, .donemessage, .infomessage, .welcomemessage +{ + padding: 10px; + padding-left: 52px; + min-height: 32px; + border-top: 1px solid $error_message_border; + border-bottom: 1px solid $error_message_border; + background-color: $error_message_bg; + background-image: url(error_message_icon.png); + background-repeat: no-repeat; + background-position: 10px 10px; +} + +.warningmessage +{ + background-image: url(warn_message_icon.png); + border-color: $warn_message_border; + background-color: $warn_message_bg; +} + +.donemessage +{ + background-image: url(done_message_icon.png); + border-color: $done_message_border; + background-color: $done_message_bg; +} + +.infomessage +{ + background-image: url(info_message_icon.png); + border-color: $info_message_border; + background-color: $info_message_bg; +} + +.welcomemessage { + padding-left: 10px; + border-color: #6666AA; + background-color: #CCCCFF; + background-image: none; +} + +.errormessagesmall, .warningmessagesmall, .donemessagesmall, .infomessagesmall +{ + padding: 5px; + padding-left: 25px; + min-height: 25px; + border-top: 1px solid $error_message_border; + border-bottom: 1px solid $error_message_border; + background-color: $error_message_bg; + background-image: url(error_small.png); + background-repeat: no-repeat; + background-position: 5px 5px; +} + +.warningmessagesmall +{ + background-image: url(warn_small.png); + border-color: $warn_message_border; + background-color: $warn_message_bg; +} + +.donemessagesmall +{ + background-image: url(ok_small.png); + border-color: $done_message_border; + background-color: $done_message_bg; +} + +.infomessagesmall +{ + background-image: url(info_small.png); + border-color: $info_message_border; + background-color: $info_message_bg; +} + +.errormark, .warningmark, .donemark, .infomark, .ok_bgr, .err_bgr +{ + padding-left: 20px; + min-height: 15px; + background: url(error_small.png) no-repeat; +} + +.warningmark +{ + background-image: url(warn_small.png); +} + +.donemark +{ + background-image: url(ok_small.png); +} + +.infomark, .ok_bgr +{ + background-image: url(info_small.png); +} + +table.colored +{ + border-top: solid $table_border 1px; + border-bottom: solid $table_border 1px; +} + +table.colored td +{ + padding: 5px; +} + +table.colored tr.header +{ + background: $table_header_bg; + background-image: url(form_title_bg.png); + background-repeat: repeat-x; + background-position: top; + border-bottom: solid $table_border 1px; + font-weight: bold; +} + +table.colored tr +{ + background: $table_row_bg; +} + +div.debug +{ + margin: 10px; + padding: 5px; + background: #FFFF99; + border: solid #FFFF33 1px; + color: black; +} + +div.odd_row +{ + background: $odd_row_bg; +} + +#footer { + position: fixed; + background: $footer_bg; + width: 100%; + left: 0px; + bottom: 0px; + color: white; + z-index:10000; + opacity:0.9; + filter:alpha(opacity:90); +} + +#footer a { + color: white; +} + +.footerheader +{ + padding: 5px; + text-align:center; + background-image: url(footer_title_bg.png); + background-position: bottom right; +} + +.footermenu +{ + /*border-top: solid white 1px; */ +} + +.footermenuitem +{ + margin-top: 5px; + margin-bottom: 5px; + margin-right: 5px; + margin-left: 25px; + display: list-item; + list-style: square outside; +} + +.footermenumessage +{ + margin: 5px; +} \ No newline at end of file diff --git a/static/june_2007_style/blue/base.css b/static/june_2007_style/blue/base.css new file mode 100644 index 00000000000..0f6e46350ae --- /dev/null +++ b/static/june_2007_style/blue/base.css @@ -0,0 +1,266 @@ +@import url( "reset.css" ); + +body +{ + font: 75% verdana, "Bitstream Vera Sans", geneva, arial, helvetica, helve, sans-serif; + background: #FFFFFF; + color: #303030; + background-image: url(base_bg.png); + background-repeat: repeat-x; + background-position: top; + margin: 10px; + margin-right: 15px; + margin-left: 15px; +} + +a:link, a:visited, a:active +{ + color: #303030; +} + +h1, h2, h3, h4 +{ + color: #023858; + /*text-shadow: #bbb 2px 2px 1px;*/ +} + +hr +{ + border: none; + border-bottom: dotted #303030 1px; +} + +div.toolForm +{ + border: solid #d8b365 1px; +} + +div.toolFormTitle +{ + font-weight: bold; + padding: 5px; + background: #d2c099; + background-image: url(form_title_bg.png); + background-repeat: repeat-x; + background-position: top; + border-bottom: solid #d8b365 1px; +} + +div.toolParamHelp +{ + font-style: italic; +} + +div.toolFormBody +{ + padding: 5px; + background: #FFFFFF; + background-image: url(form_body_bg.png); + background-repeat: repeat-x; + background-position: top; +} + +div.toolFormBody div.toolFormTitle +{ + background: transparent; + border: none; + font-weight: bold; + border-bottom: solid #d8b365 1px; + margin-bottom: 5px; +} + +div.toolHelp +{ +} + +div.toolHelpBody +{ + width: 100%; + overflow: auto; +} + +select +{ + max-width: 300px; +} + +.errormessage, .warningmessage, .donemessage, .infomessage, .welcomemessage +{ + padding: 10px; + padding-left: 52px; + min-height: 32px; + border-top: 1px solid #AA6666; + border-bottom: 1px solid #AA6666; + background-color: #FFCCCC; + background-image: url(error_message_icon.png); + background-repeat: no-repeat; + background-position: 10px 10px; +} + +.warningmessage +{ + background-image: url(warn_message_icon.png); + border-color: #AAAA66; + background-color: #FFFFCC; +} + +.donemessage +{ + background-image: url(done_message_icon.png); + border-color: #66AA66; + background-color: #CCFFCC; +} + +.infomessage +{ + background-image: url(info_message_icon.png); + border-color: #6666AA; + background-color: #CCCCFF; +} + +.welcomemessage { + padding-left: 10px; + border-color: #6666AA; + background-color: #CCCCFF; + background-image: none; +} + +.errormessagesmall, .warningmessagesmall, .donemessagesmall, .infomessagesmall +{ + padding: 5px; + padding-left: 25px; + min-height: 25px; + border-top: 1px solid #AA6666; + border-bottom: 1px solid #AA6666; + background-color: #FFCCCC; + background-image: url(error_small.png); + background-repeat: no-repeat; + background-position: 5px 5px; +} + +.warningmessagesmall +{ + background-image: url(warn_small.png); + border-color: #AAAA66; + background-color: #FFFFCC; +} + +.donemessagesmall +{ + background-image: url(ok_small.png); + border-color: #66AA66; + background-color: #CCFFCC; +} + +.infomessagesmall +{ + background-image: url(info_small.png); + border-color: #6666AA; + background-color: #CCCCFF; +} + +.errormark, .warningmark, .donemark, .infomark, .ok_bgr, .err_bgr +{ + padding-left: 20px; + min-height: 15px; + background: url(error_small.png) no-repeat; +} + +.warningmark +{ + background-image: url(warn_small.png); +} + +.donemark +{ + background-image: url(ok_small.png); +} + +.infomark, .ok_bgr +{ + background-image: url(info_small.png); +} + +table.colored +{ + border-top: solid #d8b365 1px; + border-bottom: solid #d8b365 1px; +} + +table.colored td +{ + padding: 5px; +} + +table.colored tr.header +{ + background: #ebd9b2; + background-image: url(form_title_bg.png); + background-repeat: repeat-x; + background-position: top; + border-bottom: solid #d8b365 1px; + font-weight: bold; +} + +table.colored tr +{ + background: white; +} + +div.debug +{ + margin: 10px; + padding: 5px; + background: #FFFF99; + border: solid #FFFF33 1px; + color: black; +} + +div.odd_row +{ + background: #FFFF99; +} + +#footer { + position: fixed; + background: #023858; + width: 100%; + left: 0px; + bottom: 0px; + color: white; + z-index:10000; + opacity:0.9; + filter:alpha(opacity:90); +} + +#footer a { + color: white; +} + +.footerheader +{ + padding: 5px; + text-align:center; + background-image: url(footer_title_bg.png); + background-position: bottom right; +} + +.footermenu +{ + /*border-top: solid white 1px; */ +} + +.footermenuitem +{ + margin-top: 5px; + margin-bottom: 5px; + margin-right: 5px; + margin-left: 25px; + display: list-item; + list-style: square outside; +} + +.footermenumessage +{ + margin: 5px; +} \ No newline at end of file diff --git a/static/june_2007_style/blue/base_bg.png b/static/june_2007_style/blue/base_bg.png new file mode 100644 index 00000000000..b2ed0293579 Binary files /dev/null and b/static/june_2007_style/blue/base_bg.png differ diff --git a/static/june_2007_style/blue/button_bar_bg_light.png b/static/june_2007_style/blue/button_bar_bg_light.png new file mode 100644 index 00000000000..3b31beb2a76 Binary files /dev/null and b/static/june_2007_style/blue/button_bar_bg_light.png differ diff --git a/static/june_2007_style/blue/data_empty.png b/static/june_2007_style/blue/data_empty.png new file mode 100644 index 00000000000..e081c9c44de Binary files /dev/null and b/static/june_2007_style/blue/data_empty.png differ diff --git a/static/june_2007_style/blue/data_error.png b/static/june_2007_style/blue/data_error.png new file mode 100644 index 00000000000..e081c9c44de Binary files /dev/null and b/static/june_2007_style/blue/data_error.png differ diff --git a/static/june_2007_style/blue/data_ok.png b/static/june_2007_style/blue/data_ok.png new file mode 100644 index 00000000000..63e81cce948 Binary files /dev/null and b/static/june_2007_style/blue/data_ok.png differ diff --git a/static/june_2007_style/blue/data_queued.png b/static/june_2007_style/blue/data_queued.png new file mode 100644 index 00000000000..355d6bbf063 Binary files /dev/null and b/static/june_2007_style/blue/data_queued.png differ diff --git a/static/june_2007_style/blue/data_running.gif b/static/june_2007_style/blue/data_running.gif new file mode 100644 index 00000000000..ba19ad723f2 Binary files /dev/null and b/static/june_2007_style/blue/data_running.gif differ diff --git a/static/june_2007_style/blue/done_message_icon.png b/static/june_2007_style/blue/done_message_icon.png new file mode 100644 index 00000000000..ae610f7744f Binary files /dev/null and b/static/june_2007_style/blue/done_message_icon.png differ diff --git a/static/june_2007_style/blue/error_bg.png b/static/june_2007_style/blue/error_bg.png new file mode 100644 index 00000000000..a68067de696 Binary files /dev/null and b/static/june_2007_style/blue/error_bg.png differ diff --git a/static/june_2007_style/blue/error_large.png b/static/june_2007_style/blue/error_large.png new file mode 100644 index 00000000000..2cb2e8f829d Binary files /dev/null and b/static/june_2007_style/blue/error_large.png differ diff --git a/static/june_2007_style/blue/error_message_icon.png b/static/june_2007_style/blue/error_message_icon.png new file mode 100644 index 00000000000..820ba29e064 Binary files /dev/null and b/static/june_2007_style/blue/error_message_icon.png differ diff --git a/static/june_2007_style/blue/error_small.png b/static/june_2007_style/blue/error_small.png new file mode 100644 index 00000000000..04cdc336153 Binary files /dev/null and b/static/june_2007_style/blue/error_small.png differ diff --git a/static/june_2007_style/blue/footer_title_bg.png b/static/june_2007_style/blue/footer_title_bg.png new file mode 100644 index 00000000000..2c258128a60 Binary files /dev/null and b/static/june_2007_style/blue/footer_title_bg.png differ diff --git a/static/june_2007_style/blue/form_body_bg.png b/static/june_2007_style/blue/form_body_bg.png new file mode 100644 index 00000000000..0cf6caf7fb2 Binary files /dev/null and b/static/june_2007_style/blue/form_body_bg.png differ diff --git a/static/june_2007_style/blue/form_title_bg.png b/static/june_2007_style/blue/form_title_bg.png new file mode 100644 index 00000000000..4a281d5289e Binary files /dev/null and b/static/june_2007_style/blue/form_title_bg.png differ diff --git a/static/june_2007_style/blue/gray_bg.png b/static/june_2007_style/blue/gray_bg.png new file mode 100644 index 00000000000..42247901a1b Binary files /dev/null and b/static/june_2007_style/blue/gray_bg.png differ diff --git a/static/june_2007_style/blue/hgrad.png b/static/june_2007_style/blue/hgrad.png new file mode 100644 index 00000000000..e952d3daefa Binary files /dev/null and b/static/june_2007_style/blue/hgrad.png differ diff --git a/static/june_2007_style/blue/hgrad_over.png b/static/june_2007_style/blue/hgrad_over.png new file mode 100644 index 00000000000..2e60844c15f Binary files /dev/null and b/static/june_2007_style/blue/hgrad_over.png differ diff --git a/static/june_2007_style/blue/history.css b/static/june_2007_style/blue/history.css new file mode 100644 index 00000000000..d0cbbb0e35b --- /dev/null +++ b/static/june_2007_style/blue/history.css @@ -0,0 +1,104 @@ +body +{ + background: #C1C9E5; + color: #303030; + background-image: url(menu_bg.png); + background-repeat: repeat-x; + background-position: top; + margin-top: 5px; + margin-right: 0; + margin-left: 0; + border: 0; + padding: 0; +} + +a +{ + color: #base_text; +} + +div.historyLinks +{ + padding: 5px; + margin: 5px; + padding-right: 5px; + padding-left: 5px; + margin-bottom: 5px; +} + +div.historyItem +{ + margin: 5px; + margin-right: 0px; + padding: 5px; + padding-right: 11px; + + border: solid #888888 1px; + border-left: solid #888888 5px; + border-right: none; + background: #EEEEEE; + background-image: url(gray_bg.png); + background-repeat: repeat-x; + background-position: top; +} + +div.historyItem div.historyItem +{ + margin-right: -11px; +} + +div.historyItem-ok +{ + border-color: #66AA66; + background: #CCFFCC; + /* + background-image: url(ok_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-error, div.historyItem-empty +{ + border-color: #AA6666; + background: #FFCCCC; + /* + background-image: url(error_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-running +{ + border-color: #AAAA66; + background: #FFFFCC; + /* + background-image: url(warn_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-queued +{ +} + +div.historyItemBody div +{ + padding-top: 2px; +} + +pre.peek +{ + background: white; + color: black; + width: 100%; + overflow: auto; +} + +pre.peek th +{ + color: white; + background: #023858; +} \ No newline at end of file diff --git a/static/june_2007_style/blue/info_large.png b/static/june_2007_style/blue/info_large.png new file mode 100644 index 00000000000..8ac030b0b24 Binary files /dev/null and b/static/june_2007_style/blue/info_large.png differ diff --git a/static/june_2007_style/blue/info_message_icon.png b/static/june_2007_style/blue/info_message_icon.png new file mode 100644 index 00000000000..a3cc4156ba3 Binary files /dev/null and b/static/june_2007_style/blue/info_message_icon.png differ diff --git a/static/june_2007_style/blue/info_small.png b/static/june_2007_style/blue/info_small.png new file mode 100644 index 00000000000..81522c4447f Binary files /dev/null and b/static/june_2007_style/blue/info_small.png differ diff --git a/static/june_2007_style/blue/masthead.css b/static/june_2007_style/blue/masthead.css new file mode 100644 index 00000000000..f206e7f1b44 --- /dev/null +++ b/static/june_2007_style/blue/masthead.css @@ -0,0 +1,26 @@ +body +{ + background: #2C3143 url(masthead_bg.png) bottom; + color: #eeeeee; + padding: 0; + border: 0; + margin: 3px; + margin-right: 5px; + margin-left: 5px; +} + +div.pageTitle +{ + font-size: 175%; + font-weight: bold; +} + +div.pageTitle a:link, div.pageTitle a:visited, div.pageTitle a:active, div.pageTitle a:hover +{ + text-decoration: none; +} + +a:link, a:visited, a:active +{ + color: #eeeeee; +} diff --git a/static/june_2007_style/blue/masthead_bg.png b/static/june_2007_style/blue/masthead_bg.png new file mode 100644 index 00000000000..e81e2f32c8a Binary files /dev/null and b/static/june_2007_style/blue/masthead_bg.png differ diff --git a/static/june_2007_style/blue/menu_bg.png b/static/june_2007_style/blue/menu_bg.png new file mode 100644 index 00000000000..a181ef9000d Binary files /dev/null and b/static/june_2007_style/blue/menu_bg.png differ diff --git a/static/june_2007_style/blue/ok_bg.png b/static/june_2007_style/blue/ok_bg.png new file mode 100644 index 00000000000..dd0f2731d64 Binary files /dev/null and b/static/june_2007_style/blue/ok_bg.png differ diff --git a/static/june_2007_style/blue/ok_large.png b/static/june_2007_style/blue/ok_large.png new file mode 100644 index 00000000000..e68759ac9cb Binary files /dev/null and b/static/june_2007_style/blue/ok_large.png differ diff --git a/static/june_2007_style/blue/ok_small.png b/static/june_2007_style/blue/ok_small.png new file mode 100644 index 00000000000..dee022cee56 Binary files /dev/null and b/static/june_2007_style/blue/ok_small.png differ diff --git a/static/june_2007_style/blue/panel_header_bg.png b/static/june_2007_style/blue/panel_header_bg.png new file mode 100644 index 00000000000..37ce50151b8 Binary files /dev/null and b/static/june_2007_style/blue/panel_header_bg.png differ diff --git a/static/june_2007_style/blue/reset.css b/static/june_2007_style/blue/reset.css new file mode 100644 index 00000000000..0eb970e56bf --- /dev/null +++ b/static/june_2007_style/blue/reset.css @@ -0,0 +1,3 @@ +/* Copyright (c) 2007, Yahoo! Inc. All rights reserved. */ +body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;} +/*body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}*/ diff --git a/static/june_2007_style/blue/tiny_arror_right.png b/static/june_2007_style/blue/tiny_arror_right.png new file mode 100644 index 00000000000..05d1970b3fa Binary files /dev/null and b/static/june_2007_style/blue/tiny_arror_right.png differ diff --git a/static/june_2007_style/blue/tiny_arrow_left.png b/static/june_2007_style/blue/tiny_arrow_left.png new file mode 100644 index 00000000000..a11d0267cee Binary files /dev/null and b/static/june_2007_style/blue/tiny_arrow_left.png differ diff --git a/static/june_2007_style/blue/tiny_arrow_right.png b/static/june_2007_style/blue/tiny_arrow_right.png new file mode 100644 index 00000000000..05d1970b3fa Binary files /dev/null and b/static/june_2007_style/blue/tiny_arrow_right.png differ diff --git a/static/june_2007_style/blue/tool_menu.css b/static/june_2007_style/blue/tool_menu.css new file mode 100644 index 00000000000..b1f5cd413cf --- /dev/null +++ b/static/june_2007_style/blue/tool_menu.css @@ -0,0 +1,46 @@ +body +{ + background: white; + color: #303030; + background: #C1C9E5 url(menu_bg.png) top repeat-x; + margin: 5px; + margin-right: 10px; + margin-left: 10px; +} + +hr +{ + border: none; + height: 0px; + margin-top: 0px; +} + +div.toolSectionPad +{ + margin: 0; + padding: 0; + height: 5px; + font-size: 0px; +} + +div.toolSectionDetailsInner +{ + margin-left: 5px; + margin-right: 5px; +} + +div.toolSectionTitle +{ + padding-bottom: 0px; + font-weight: bold; +} + +div.toolTitle +{ + padding-top: 5px; + padding-bottom: 5px; + margin-left: 16px; + margin-right: 10px; + display: list-item; + list-style: square outside; +} diff --git a/static/june_2007_style/blue/wait_large.png b/static/june_2007_style/blue/wait_large.png new file mode 100644 index 00000000000..480d6d9bc72 Binary files /dev/null and b/static/june_2007_style/blue/wait_large.png differ diff --git a/static/june_2007_style/blue/wait_small.png b/static/june_2007_style/blue/wait_small.png new file mode 100644 index 00000000000..7202be86447 Binary files /dev/null and b/static/june_2007_style/blue/wait_small.png differ diff --git a/static/june_2007_style/blue/warn_bg.png b/static/june_2007_style/blue/warn_bg.png new file mode 100644 index 00000000000..4ed6df05a5c Binary files /dev/null and b/static/june_2007_style/blue/warn_bg.png differ diff --git a/static/june_2007_style/blue/warn_large.png b/static/june_2007_style/blue/warn_large.png new file mode 100644 index 00000000000..c4c4af28678 Binary files /dev/null and b/static/june_2007_style/blue/warn_large.png differ diff --git a/static/june_2007_style/blue/warn_message_icon.png b/static/june_2007_style/blue/warn_message_icon.png new file mode 100644 index 00000000000..f217d2d8f6a Binary files /dev/null and b/static/june_2007_style/blue/warn_message_icon.png differ diff --git a/static/june_2007_style/blue/warn_small.png b/static/june_2007_style/blue/warn_small.png new file mode 100644 index 00000000000..34c0c93b625 Binary files /dev/null and b/static/june_2007_style/blue/warn_small.png differ diff --git a/static/june_2007_style/blue_colors.ini b/static/june_2007_style/blue_colors.ini new file mode 100644 index 00000000000..879e9240ece --- /dev/null +++ b/static/june_2007_style/blue_colors.ini @@ -0,0 +1,53 @@ +base_text=#303030 +base_bg_top=#FFFFFF +base_bg_bottom=#FFFFFF +link_text=#303030 +header_text=#023858 +menu_bg_top=#DADFEF +menu_bg_over=#C1C9E5 +menu_bg_hatch=- +#menu_bg_hatch=#AAAAFF +# Forms +form_title_bg_top=#ebd9b2 +form_title_bg_bottom=#d2c099 +form_title_bg_hatch=- +form_border=#d8b365 +#form_body_bg=#FFFFFF +form_body_bg_top=#FFFFFF +form_body_bg_bottom=#FFFFFF +odd_row_bg=#FFFF99 +# Messages +error_message_border=#AA6666 +error_message_bg=#FFCCCC +warn_message_border=#AAAA66 +warn_message_bg=#FFFFCC +done_message_border=#66AA66 +done_message_bg=#CCFFCC +info_message_border=#6666AA +info_message_bg=#CCCCFF +# Tables +table_header_bg=#ebd9b2 +table_row_bg=white +table_border=#d8b365 +# Footers +footer_bg=#023858 +footer_title_bg=#023858 +footer_title_hatch=#000000 +# History +history_error_border=#AA6666 +history_error_bg=#FFCCCC +history_running_border=#AAAA66 +history_running_bg=#FFFFCC +history_ok_border=#66AA66 +history_ok_bg=#CCFFCC +history_queued_border=#888888 +history_queued_bg=#EEEEEE +peek_table_header=#023858 +# Masthead +masthead_bg=#2C3143 +masthead_text=#eeeeee +masthead_bg_hatch=- +masthead_link=#eeeeee +# Layout +panel_header_bg_top=#f5f5f5 +panel_header_bg_bottom=#cccccc diff --git a/static/june_2007_style/blue_colors.ini.bak b/static/june_2007_style/blue_colors.ini.bak new file mode 100644 index 00000000000..2878f74bed7 --- /dev/null +++ b/static/june_2007_style/blue_colors.ini.bak @@ -0,0 +1,50 @@ +base_text=#303030 +base_bg=#F4EBE2 +base_bg_top=#FFFFFF +link_text=#303030 +header_text=#023858 +menu_bg_top=#EEEEFF +menu_bg_over=#CCCCFF +menu_bg_hatch=- +#menu_bg_hatch=#AAAAFF +# Forms +form_title_bg=#FFFFFF +form_title_bg_hatch=#d2c099 +form_border=#AAAACC +form_body_bg=#FFFFDB +odd_row_bg=#FFFF99 +# Messages +error_message_border=#AA6666 +error_message_bg=#FFCCCC +warn_message_border=#AAAA66 +warn_message_bg=#FFFFCC +done_message_border=#66AA66 +done_message_bg=#CCFFCC +info_message_border=#6666AA +info_message_bg=#CCCCFF +# Tables +table_header_bg=#ebd9b2 +table_row_bg=white +table_border=#d8b365 +# Footers +footer_bg=#023858 +footer_title_bg=#023858 +footer_title_hatch=#000000 +# History +history_error_border=#AA6666 +history_error_bg=#FFCCCC +history_running_border=#AAAA66 +history_running_bg=#FFFFCC +history_ok_border=#66AA66 +history_ok_bg=#CCFFCC +history_queued_border=#888888 +history_queued_bg=#EEEEEE +peek_table_header=#023858 +# Masthead +masthead_bg=#011e30 +masthead_text=#eeeeee +masthead_bg_hatch=- +masthead_link=#eeeeee +# Layout +panel_header_bg_top=#f5f5f5 +panel_header_bg_bottom=#cccccc diff --git a/static/june_2007_style/galaxy_icons.svg b/static/june_2007_style/galaxy_icons.svg new file mode 100644 index 00000000000..6a34999b592 --- /dev/null +++ b/static/june_2007_style/galaxy_icons.svg @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/june_2007_style/galaxy_spinner.fla b/static/june_2007_style/galaxy_spinner.fla new file mode 100644 index 00000000000..e984be2a0ea Binary files /dev/null and b/static/june_2007_style/galaxy_spinner.fla differ diff --git a/static/june_2007_style/gradient.py b/static/june_2007_style/gradient.py new file mode 100755 index 00000000000..7e8403b1b30 --- /dev/null +++ b/static/june_2007_style/gradient.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python2.4 + +""" +usage: %prog width height bg_color hatch_color [color alpha stop_pos] + +""" + +from __future__ import division + +import sys +import cairo + +def parse_css_color( color ): + if color.startswith( '#' ): + color = color[1:] + if len( color ) == 3: + r = int( color[0], 16 ) + g = int( color[1], 16 ) + b = int( color[2], 16 ) + elif len( color ) == 6: + r = int( color[0:2], 16 ) + g = int( color[2:4], 16 ) + b = int( color[4:6], 16 ) + else: + raise Exception( "Color should be 3 hex numbers" ) + return r/256, g/256, b/256 + +def gradient( width, height, args ): + pat = cairo.LinearGradient(0.0, 0.0, 0.0, height) + while len( args ) > 2: + col = parse_css_color( args[0] ) + alpha = float( args[1]) + pos = float( args[2] ) + pat.add_color_stop_rgba( pos, col[0], col[1], col[2], alpha ) + args = args[3:] + return pat + +def hatch( width, height, color ): + im_surf = cairo.ImageSurface( cairo.FORMAT_ARGB32, width, width ) + c = cairo.Context( im_surf ) + c.set_source_rgb ( *color ) + c.set_line_width( 0.75 ) + for i in range( 0, 2*max(height,width), 3 ): + c.move_to ( 0-10, i+10 ) + c.line_to ( width+10, i - width - 10 ) + c.stroke() + pat = cairo.SurfacePattern( im_surf ) + pat.set_extend (cairo.EXTEND_REPEAT) + return pat + +width = int( sys.argv[1] ) +height = int( sys.argv[2] ) + +surface = cairo.ImageSurface( cairo.FORMAT_ARGB32, width, height ) +c = cairo.Context( surface ) + +c.rectangle(0,0,width,height) +c.set_source_rgb( *parse_css_color( sys.argv[3] ) ) +c.fill() + +if sys.argv[4] != "-": + c.rectangle (0, 0, width, height) + c.set_source( hatch( width, height, parse_css_color( sys.argv[4] ) ) ) + c.fill() + +pat = cairo.LinearGradient(0.0, 0.0, 0.0, height) +pat.add_color_stop_rgba( 0, 1, 1, 1, 0 ) +pat.add_color_stop_rgba( 1, 1, 1, 1, 1 ) +c.rectangle (0, 0, width, height) +c.set_source( gradient( width, height, sys.argv[5:] ) ) +c.fill() + +surface.write_to_png( "/dev/stdout" ) diff --git a/static/june_2007_style/history.css.tmpl b/static/june_2007_style/history.css.tmpl new file mode 100644 index 00000000000..901a2fa82ab --- /dev/null +++ b/static/june_2007_style/history.css.tmpl @@ -0,0 +1,104 @@ +body +{ + background: $menu_bg_over; + color: $base_text; + background-image: url(menu_bg.png); + background-repeat: repeat-x; + background-position: top; + margin-top: 5px; + margin-right: 0; + margin-left: 0; + border: 0; + padding: 0; +} + +a +{ + color: #base_text; +} + +div.historyLinks +{ + padding: 5px; + margin: 5px; + padding-right: 5px; + padding-left: 5px; + margin-bottom: 5px; +} + +div.historyItem +{ + margin: 5px; + margin-right: 0px; + padding: 5px; + padding-right: 11px; + + border: solid $history_queued_border 1px; + border-left: solid $history_queued_border 5px; + border-right: none; + background: $history_queued_bg; + background-image: url(gray_bg.png); + background-repeat: repeat-x; + background-position: top; +} + +div.historyItem div.historyItem +{ + margin-right: -11px; +} + +div.historyItem-ok +{ + border-color: $history_ok_border; + background: $history_ok_bg; + /* + background-image: url(ok_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-error, div.historyItem-empty +{ + border-color: $history_error_border; + background: $history_error_bg; + /* + background-image: url(error_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-running +{ + border-color: $history_running_border; + background: $history_running_bg; + /* + background-image: url(warn_bg.png); + background-repeat: repeat-x; + background-position: top; + */ +} + +div.historyItem-queued +{ +} + +div.historyItemBody div +{ + padding-top: 2px; +} + +pre.peek +{ + background: white; + color: black; + width: 100%; + overflow: auto; +} + +pre.peek th +{ + color: white; + background: $peek_table_header; +} \ No newline at end of file diff --git a/static/june_2007_style/make_style.py b/static/june_2007_style/make_style.py new file mode 100755 index 00000000000..c0d6da6571a --- /dev/null +++ b/static/june_2007_style/make_style.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python2.4 + +import sys +from Cheetah.Template import Template +import string +from subprocess import Popen, PIPE +import os.path + +def run( cmd ): + return Popen( cmd, stdout=PIPE).communicate()[0] + +templates = [ ( "base.css.tmpl", "base.css" ), + ( "masthead.css.tmpl", "masthead.css"), + ( "history.css.tmpl", "history.css" ), + ( "tool_menu.css.tmpl", "tool_menu.css" ), + ( "reset.css.tmpl", "reset.css" ) ] + +images = [ + ( "./gradient.py 9 30 $panel_header_bg_top - $panel_header_bg_bottom 0 0 $panel_header_bg_bottom 1 1", "panel_header_bg.png" ), + ( "./gradient.py 9 1000 $menu_bg_top $menu_bg_hatch $menu_bg_over 0 0 $menu_bg_over 1 1", "menu_bg.png" ), + ( "./gradient.py 9 1000 $base_bg_top - $base_bg_bottom 0 0 $base_bg_bottom 1 1", "base_bg.png" ), + ( "./gradient.py 9 500 $form_body_bg_top - $form_body_bg_bottom 0 0 $form_body_bg_bottom 1 1", "form_body_bg.png" ), + ( "./gradient.py 9 50 $masthead_bg $masthead_bg_hatch", "masthead_bg.png" ), + ( "./gradient.py 9 30 $footer_title_bg $footer_title_hatch 000000 0 0.5 000000 1 1", "footer_title_bg.png" ), + ( "./gradient.py 9 50 $form_title_bg_top $form_title_bg_hatch $form_title_bg_bottom 0 0 $form_title_bg_bottom 1 1", "form_title_bg.png" ), + ( "./gradient.py 9 200 $history_ok_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "ok_bg.png" ), + ( "./gradient.py 9 200 $history_error_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "error_bg.png" ), + ( "./gradient.py 9 200 $history_running_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "warn_bg.png" ), + ( "./gradient.py 9 200 $history_queued_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "gray_bg.png" ) ] + +shared_images = [ + # Dialog boxes + ( "ok_large.png", "done_message_bg", "done_message_icon.png" ), + ( "info_large.png", "info_message_bg", "info_message_icon.png" ), + ( "warn_large.png", "warn_message_bg", "warn_message_icon.png" ), + ( "error_large.png", "error_message_bg", "error_message_icon.png" ), + # History icons + ( "ok_small.png", "history_ok_bg", "data_ok.png" ), + ( "error_small.png", "history_error_bg", "data_error.png" ), + ( "wait_small.png", "history_queued_bg", "data_queued.png" ) ] + + +vars, out_dir = sys.argv[1:] + +context = dict() +for line in open( vars ): + if line.startswith( '#' ): + continue + key, value = line.rstrip("\r\n").split( '=' ) + if value.startswith( '"' ) and value.endswith( '"' ): + value = value[1:-1] + context[key] = value + +for input, output in templates: + print input ,"->", output + open( os.path.join( out_dir, output ), "w" ).write( str( Template( file=input, searchList=[context] ) ) ) + +for rule, output in images: + t = string.Template( rule ).substitute( context ) + print t, "->", output + open( os.path.join( out_dir, output ), "w" ).write( run( t.split() ) ) + +for src, bg, out in shared_images: + t = "./png_over_color.py shared_images/%s %s %s" % ( src, context[bg], os.path.join( out_dir, out ) ) + print t + run( t.split() ) diff --git a/static/june_2007_style/masthead.css.tmpl b/static/june_2007_style/masthead.css.tmpl new file mode 100644 index 00000000000..0c759f2aba6 --- /dev/null +++ b/static/june_2007_style/masthead.css.tmpl @@ -0,0 +1,26 @@ +body +{ + background: $masthead_bg url(masthead_bg.png) bottom; + color: $masthead_text; + padding: 0; + border: 0; + margin: 3px; + margin-right: 5px; + margin-left: 5px; +} + +div.pageTitle +{ + font-size: 175%; + font-weight: bold; +} + +div.pageTitle a:link, div.pageTitle a:visited, div.pageTitle a:active, div.pageTitle a:hover +{ + text-decoration: none; +} + +a:link, a:visited, a:active +{ + color: $masthead_link; +} diff --git a/static/june_2007_style/png_over_color.py b/static/june_2007_style/png_over_color.py new file mode 100755 index 00000000000..b1a72c57cd0 --- /dev/null +++ b/static/june_2007_style/png_over_color.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python2.4 + +import sys +import Image +import ImageColor + +over = Image.open( sys.argv[1] ) +color = ImageColor.getrgb( sys.argv[2] ) + +new = Image.new( 'RGBA', over.size, color ) + +# 'Over' is passed twice since it has an alpha channel -- it is it's own mask +new.paste( over, over ) + +new.save( sys.argv[3] ) \ No newline at end of file diff --git a/static/june_2007_style/reset.css.tmpl b/static/june_2007_style/reset.css.tmpl new file mode 100644 index 00000000000..0eb970e56bf --- /dev/null +++ b/static/june_2007_style/reset.css.tmpl @@ -0,0 +1,3 @@ +/* Copyright (c) 2007, Yahoo! Inc. All rights reserved. */ +body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;} +/*body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}*/ diff --git a/static/june_2007_style/shared_images/data_empty.png b/static/june_2007_style/shared_images/data_empty.png new file mode 100644 index 00000000000..04cdc336153 Binary files /dev/null and b/static/june_2007_style/shared_images/data_empty.png differ diff --git a/static/june_2007_style/shared_images/data_error.png b/static/june_2007_style/shared_images/data_error.png new file mode 100644 index 00000000000..04cdc336153 Binary files /dev/null and b/static/june_2007_style/shared_images/data_error.png differ diff --git a/static/june_2007_style/shared_images/data_ok.png b/static/june_2007_style/shared_images/data_ok.png new file mode 100644 index 00000000000..dee022cee56 Binary files /dev/null and b/static/june_2007_style/shared_images/data_ok.png differ diff --git a/static/june_2007_style/shared_images/data_queued.png b/static/june_2007_style/shared_images/data_queued.png new file mode 100644 index 00000000000..7202be86447 Binary files /dev/null and b/static/june_2007_style/shared_images/data_queued.png differ diff --git a/static/june_2007_style/shared_images/data_running.gif b/static/june_2007_style/shared_images/data_running.gif new file mode 100644 index 00000000000..ba19ad723f2 Binary files /dev/null and b/static/june_2007_style/shared_images/data_running.gif differ diff --git a/static/june_2007_style/shared_images/error_large.png b/static/june_2007_style/shared_images/error_large.png new file mode 100644 index 00000000000..2cb2e8f829d Binary files /dev/null and b/static/june_2007_style/shared_images/error_large.png differ diff --git a/static/june_2007_style/shared_images/error_small.png b/static/june_2007_style/shared_images/error_small.png new file mode 100644 index 00000000000..04cdc336153 Binary files /dev/null and b/static/june_2007_style/shared_images/error_small.png differ diff --git a/static/june_2007_style/shared_images/info_large.png b/static/june_2007_style/shared_images/info_large.png new file mode 100644 index 00000000000..8ac030b0b24 Binary files /dev/null and b/static/june_2007_style/shared_images/info_large.png differ diff --git a/static/june_2007_style/shared_images/info_small.png b/static/june_2007_style/shared_images/info_small.png new file mode 100644 index 00000000000..81522c4447f Binary files /dev/null and b/static/june_2007_style/shared_images/info_small.png differ diff --git a/static/june_2007_style/shared_images/ok_large.png b/static/june_2007_style/shared_images/ok_large.png new file mode 100644 index 00000000000..e68759ac9cb Binary files /dev/null and b/static/june_2007_style/shared_images/ok_large.png differ diff --git a/static/june_2007_style/shared_images/ok_small.png b/static/june_2007_style/shared_images/ok_small.png new file mode 100644 index 00000000000..dee022cee56 Binary files /dev/null and b/static/june_2007_style/shared_images/ok_small.png differ diff --git a/static/june_2007_style/shared_images/wait_large.png b/static/june_2007_style/shared_images/wait_large.png new file mode 100644 index 00000000000..480d6d9bc72 Binary files /dev/null and b/static/june_2007_style/shared_images/wait_large.png differ diff --git a/static/june_2007_style/shared_images/wait_small.png b/static/june_2007_style/shared_images/wait_small.png new file mode 100644 index 00000000000..7202be86447 Binary files /dev/null and b/static/june_2007_style/shared_images/wait_small.png differ diff --git a/static/june_2007_style/shared_images/warn_large.png b/static/june_2007_style/shared_images/warn_large.png new file mode 100644 index 00000000000..c4c4af28678 Binary files /dev/null and b/static/june_2007_style/shared_images/warn_large.png differ diff --git a/static/june_2007_style/shared_images/warn_small.png b/static/june_2007_style/shared_images/warn_small.png new file mode 100644 index 00000000000..34c0c93b625 Binary files /dev/null and b/static/june_2007_style/shared_images/warn_small.png differ diff --git a/static/june_2007_style/tool_menu.css.tmpl b/static/june_2007_style/tool_menu.css.tmpl new file mode 100644 index 00000000000..ccf1ab9cad9 --- /dev/null +++ b/static/june_2007_style/tool_menu.css.tmpl @@ -0,0 +1,46 @@ +body +{ + background: white; + color: $base_text; + background: $menu_bg_over url(menu_bg.png) top repeat-x; + margin: 5px; + margin-right: 10px; + margin-left: 10px; +} + +hr +{ + border: none; + height: 0px; + margin-top: 0px; +} + +div.toolSectionPad +{ + margin: 0; + padding: 0; + height: 5px; + font-size: 0px; +} + +div.toolSectionDetailsInner +{ + margin-left: 5px; + margin-right: 5px; +} + +div.toolSectionTitle +{ + padding-bottom: 0px; + font-weight: bold; +} + +div.toolTitle +{ + padding-top: 5px; + padding-bottom: 5px; + margin-left: 16px; + margin-right: 10px; + display: list-item; + list-style: square outside; +} diff --git a/static/scripts/jquery.dimensions.js b/static/scripts/jquery.dimensions.js new file mode 100644 index 00000000000..8b33e954fc2 --- /dev/null +++ b/static/scripts/jquery.dimensions.js @@ -0,0 +1,574 @@ +/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || 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-07-01 21:19:35 -0400 (Sun, 01 Jul 2007) $ + * $Rev: 2209 $ + * + * Version: 1.0rc1 + */ + +(function($){ + +// store a copy of the core height and width methods +var height = $.fn.height, + width = $.fn.width; + +$.fn.extend({ + /** + * If used on document, returns the document's height (innerHeight). + * If used on window, returns the viewport's (window) height. + * See core docs on height() to see what happens when used on an element. + * + * @example $("#testdiv").height() + * @result 200 + * + * @example $(document).height() + * @result 800 + * + * @example $(window).height() + * @result 400 + * + * @name height + * @type Number + * @cat Plugins/Dimensions + */ + height: function() { + if ( this[0] == window ) + return self.innerHeight || + $.boxModel && document.documentElement.clientHeight || + document.body.clientHeight; + + if ( this[0] == document ) + return Math.max( document.body.scrollHeight, document.body.offsetHeight ); + + return height.apply(this, arguments); + }, + + /** + * If used on document, returns the document's width (innerWidth). + * If used on window, returns the viewport's (window) width. + * See core docs on width() to see what happens when used on an element. + * + * @example $("#testdiv").width() + * @result 200 + * + * @example $(document).width() + * @result 800 + * + * @example $(window).width() + * @result 400 + * + * @name width + * @type Number + * @cat Plugins/Dimensions + */ + width: function() { + if ( this[0] == window ) + return self.innerWidth || + $.boxModel && document.documentElement.clientWidth || + document.body.clientWidth; + + if ( this[0] == document ) + return Math.max( document.body.scrollWidth, document.body.offsetWidth ); + + return width.apply(this, arguments); + }, + + /** + * Returns the inner height value (without the border) for the first matched element. + * If used on document, returns the document's height (innerHeight). + * If used on window, returns the viewport's (window) height. + * + * @example $("#testdiv").innerHeight() + * @result 210 + * + * @name innerHeight + * @type Number + * @cat Plugins/Dimensions + */ + innerHeight: function() { + return this[0] == window || this[0] == document ? + this.height() : + this.is(':visible') ? + this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') : + this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom'); + }, + + /** + * Returns the inner width value (without the border) for the first matched element. + * If used on document, returns the document's width (innerWidth). + * If used on window, returns the viewport's (window) width. + * + * @example $("#testdiv").innerWidth() + * @result 210 + * + * @name innerWidth + * @type Number + * @cat Plugins/Dimensions + */ + innerWidth: function() { + return this[0] == window || this[0] == document ? + this.width() : + this.is(':visible') ? + this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') : + this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight'); + }, + + /** + * Returns the outer height value (including the border) for the first matched element. + * If used on document, returns the document's height (innerHeight). + * If used on window, returns the viewport's (window) height. + * + * @example $("#testdiv").outerHeight() + * @result 220 + * + * @name outerHeight + * @type Number + * @cat Plugins/Dimensions + */ + outerHeight: function() { + return this[0] == window || this[0] == document ? + this.height() : + this.is(':visible') ? + this[0].offsetHeight : + this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom'); + }, + + /** + * Returns the outer width value (including the border) for the first matched element. + * If used on document, returns the document's width (innerWidth). + * If used on window, returns the viewport's (window) width. + * + * @example $("#testdiv").outerHeight() + * @result 1000 + * + * @name outerHeight + * @type Number + * @cat Plugins/Dimensions + */ + outerWidth: function() { + return this[0] == window || this[0] == document ? + this.width() : + this.is(':visible') ? + this[0].offsetWidth : + this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight'); + }, + + /** + * Returns how many pixels the user has scrolled to the right (scrollLeft). + * Works on containers with overflow: auto and window/document. + * + * @example $(window).scrollLeft() + * @result 100 + * + * @example $(document).scrollLeft() + * @result 100 + * + * @example $("#testdiv").scrollLeft() + * @result 100 + * + * @name scrollLeft + * @type Number + * @cat Plugins/Dimensions + */ + /** + * Sets the scrollLeft property for each element and continues the chain. + * Works on containers with overflow: auto and window/document. + * + * @example $(window).scrollLeft(100).scrollLeft() + * @result 100 + * + * @example $(document).scrollLeft(100).scrollLeft() + * @result 100 + * + * @example $("#testdiv").scrollLeft(100).scrollLeft() + * @result 100 + * + * @name scrollLeft + * @param Number value A positive number representing the desired scrollLeft. + * @type jQuery + * @cat Plugins/Dimensions + */ + scrollLeft: function(val) { + if ( val != undefined ) + // set the scroll left + return this.each(function() { + if (this == window || this == document) + window.scrollTo( val, $(window).scrollTop() ); + else + this.scrollLeft = val; + }); + + // return the scroll left offest in pixels + if ( this[0] == window || this[0] == document ) + return self.pageXOffset || + $.boxModel && document.documentElement.scrollLeft || + document.body.scrollLeft; + + return this[0].scrollLeft; + }, + + /** + * Returns how many pixels the user has scrolled to the bottom (scrollTop). + * Works on containers with overflow: auto and window/document. + * + * @example $(window).scrollTop() + * @result 100 + * + * @example $(document).scrollTop() + * @result 100 + * + * @example $("#testdiv").scrollTop() + * @result 100 + * + * @name scrollTop + * @type Number + * @cat Plugins/Dimensions + */ + /** + * Sets the scrollTop property for each element and continues the chain. + * Works on containers with overflow: auto and window/document. + * + * @example $(window).scrollTop(100).scrollTop() + * @result 100 + * + * @example $(document).scrollTop(100).scrollTop() + * @result 100 + * + * @example $("#testdiv").scrollTop(100).scrollTop() + * @result 100 + * + * @name scrollTop + * @param Number value A positive number representing the desired scrollTop. + * @type jQuery + * @cat Plugins/Dimensions + */ + scrollTop: function(val) { + if ( val != undefined ) + // set the scroll top + return this.each(function() { + if (this == window || this == document) + window.scrollTo( $(window).scrollLeft(), val ); + else + this.scrollTop = val; + }); + + // return the scroll top offset in pixels + if ( this[0] == window || this[0] == document ) + return self.pageYOffset || + $.boxModel && document.documentElement.scrollTop || + document.body.scrollTop; + + return this[0].scrollTop; + }, + + /** + * Returns the top and left positioned offset in pixels. + * The positioned offset is the offset between a positioned + * parent and the element itself. The position method takes + * an optional map of key value pairs to configure the way + * the offset is calculated. Here are the different options. + * + * (Boolean) margin - Should the margin of the element be included in the calculations? False by default. + * (Boolean) border - Should the border of the element be included in the calculations? False by default. + * (Boolean) padding - Should the padding of the element be included in the calcuations? False by default. + * (Boolean) scroll - Sould the scroll offsets of the parent elements be included int he calculations? False by default. + * When true it adds the total scroll offsets of all parents to the total offset and also adds two + * properties to the returned object, scrollTop and scrollLeft. + * + * Also an object can be passed as the second paramater to + * catch the value of the return and continue the chain. + * + * For accurate readings make sure to use pixel values for margins, borders and padding. + * + * @example $("#testdiv").position() + * @result { top: 100, left: 100 } + * + * @example $("#testdiv").position({ margin: true, border: true, padding: true }) + * @result { top: 90, left: 90 } + * + * @example var position = {}; + * $("#testdiv").position({}, position) + * @result position = { top: 100, left: 100 } + * + * @name position + * @param Map options Optional settings to configure the way the offset is calculated. + * @param Object returnObject Optional An object to store the return value in, so as not to break the chain. If passed in the + * chain will not be broken and the result will be assigned to this object. + * @type Object + * @cat Plugins/Dimensions + */ + position: function(options, returnObject) { + var elem = this[0], parent = elem.parentNode, op = elem.offsetParent, + options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}), + x = elem.offsetLeft, + y = elem.offsetTop, + sl = elem.scrollLeft, + st = elem.scrollTop; + + // Mozilla and IE do not add the border + if ($.browser.mozilla || $.browser.msie) { + // add borders to offset + x += num(elem, 'borderLeftWidth'); + y += num(elem, 'borderTopWidth'); + } + + // Safari and opera includes border on positioned parents + if (($.browser.safari || $.browser.opera) && $.css(op, 'position') != 'static') { + x -= num(op, 'borderLeftWidth'); + y -= num(op, 'borderTopWidth'); + } + + if ($.browser.mozilla) { + do { + // Mozilla does not add the border for a parent that has overflow set to anything but visible + if (parent != elem && $.css(parent, 'overflow') != 'visible') { + x += num(parent, 'borderLeftWidth'); + y += num(parent, 'borderTopWidth'); + } + + if (parent == op) break; // break if we are already at the offestParent + } while ((parent = parent.parentNode) && parent.tagName != 'BODY'); + } + + if ($.browser.msie && (op.tagName != 'BODY' && $.css(op, 'position') == 'static')) { + do { + x += op.offsetLeft; + y += op.offsetTop; + // add borders to offset + x += num(op, 'borderLeftWidth'); + y += num(op, 'borderTopWidth'); + } while ((op = op.offsetParent) && (op.tagName != 'BODY' && $.css(op, 'position') == 'static')); + } + + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st); + + if (returnObject) { $.extend(returnObject, returnValue); return this; } + else { return returnValue; } + }, + + /** + * Returns the location of the element in pixels from the top left corner of the viewport. + * The offset method takes an optional map of key value pairs to configure the way + * the offset is calculated. Here are the different options. + * + * (Boolean) margin - Should the margin of the element be included in the calculations? True by default. + * (Boolean) border - Should the border of the element be included in the calculations? False by default. + * (Boolean) padding - Should the padding of the element be included in the calcuations? False by default. + * (Boolean) scroll - Sould the scroll offsets of the parent elements be included int he calculations? True by default. + * When true it adds the total scroll offsets of all parents to the total offset and also adds two + * properties to the returned object, scrollTop and scrollLeft. + * (Boolean) lite - When true it will use the offsetLite method instead of the full-blown, slower offset method. False by default. + * Only use this when margins, borders and padding calculations don't matter. + * + * Also an object can be passed as the second paramater to + * catch the value of the return and continue the chain. + * + * For accurate readings make sure to use pixel values for margins, borders and padding. + * + * Known issues: + * - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari + * Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden + * + * @example $("#testdiv").offset() + * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 } + * + * @example $("#testdiv").offset({ scroll: false }) + * @result { top: 90, left: 90 } + * + * @example var offset = {} + * $("#testdiv").offset({ scroll: false }, offset) + * @result offset = { top: 90, left: 90 } + * + * @name offset + * @param Map options Optional settings to configure the way the offset is calculated. + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the + * chain will not be broken and the result will be assigned to this object. + * @type Object + * @cat Plugins/Dimensions + */ + offset: function(options, returnObject) { + var x = 0, y = 0, sl = 0, st = 0, + elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'), + mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera, + absparent = false, relparent = false, + options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {}); + + // Use offsetLite if lite option is true + if (options.lite) return this.offsetLite(options, returnObject); + + if (elem.tagName == 'BODY') { + // Safari is the only one to get offsetLeft and offsetTop properties of the body "correct" + // Except they all mess up when the body is positioned absolute or relative + x = elem.offsetLeft; + y = elem.offsetTop; + // Mozilla ignores margin and subtracts border from body element + if (mo) { + x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2); + y += num(elem, 'marginTop') + (num(elem, 'borderTopWidth') *2); + } else + // Opera ignores margin + if (oa) { + x += num(elem, 'marginLeft'); + y += num(elem, 'marginTop'); + } else + // IE does not add the border in Standards Mode + if (ie && jQuery.boxModel) { + x += num(elem, 'borderLeftWidth'); + y += num(elem, 'borderTopWidth'); + } + } else { + do { + parPos = $.css(parent, 'position'); + + x += parent.offsetLeft; + y += parent.offsetTop; + + // Mozilla and IE do not add the border + if (mo || ie) { + // add borders to offset + x += num(parent, 'borderLeftWidth'); + y += num(parent, 'borderTopWidth'); + + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent + if (mo && parPos == 'absolute') absparent = true; + // IE does not include the border on the body if an element is position static and without an absolute or relative parent + if (ie && parPos == 'relative') relparent = true; + } + + op = parent.offsetParent; + if (options.scroll || mo) { + do { + if (options.scroll) { + // get scroll offsets + sl += parent.scrollLeft; + st += parent.scrollTop; + } + + // Mozilla does not add the border for a parent that has overflow set to anything but visible + if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') { + x += num(parent, 'borderLeftWidth'); + y += num(parent, 'borderTopWidth'); + } + + parent = parent.parentNode; + } while (parent != op); + } + parent = op; + + if (parent.tagName == 'BODY' || parent.tagName == 'HTML') { + // Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative + if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') { + x += num(parent, 'marginLeft'); + y += num(parent, 'marginTop'); + } + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent + // IE does not include the border on the body if an element is positioned static and without an absolute or relative parent + if ( (mo && !absparent && elemPos != 'fixed') || + (ie && elemPos == 'static' && !relparent) ) { + x += num(parent, 'borderLeftWidth'); + y += num(parent, 'borderTopWidth'); + } + break; // Exit the loop + } + } while (parent); + } + + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st); + + if (returnObject) { $.extend(returnObject, returnValue); return this; } + else { return returnValue; } + }, + + /** + * Returns the location of the element in pixels from the top left corner of the viewport. + * This method is much faster than offset but not as accurate. This method can be invoked + * by setting the lite option to true in the offset method. + * The offsetLite method takes an optional map of key value pairs to configure the way + * the offset is calculated. Here are the different options. + * + * (Boolean) margin - Should the margin of the element be included in the calculations? True by default. + * (Boolean) border - Should the border of the element be included in the calculations? False by default. + * (Boolean) padding - Should the padding of the element be included in the calcuations? False by default. + * (Boolean) scroll - Sould the scroll offsets of the parent elements be included int he calculations? True by default. + * When true it adds the total scroll offsets of all parents to the total offset and also adds two + * properties to the returned object, scrollTop and scrollLeft. + * + * @name offsetLite + * @param Map options Optional settings to configure the way the offset is calculated. + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the + * chain will not be broken and the result will be assigned to this object. + * @type Object + * @cat Plugins/Dimensions + */ + offsetLite: function(options, returnObject) { + var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op, + options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {}); + + do { + x += parent.offsetLeft; + y += parent.offsetTop; + + op = parent.offsetParent; + if (options.scroll) { + // get scroll offsets + do { + sl += parent.scrollLeft; + st += parent.scrollTop; + parent = parent.parentNode; + } while(parent != op); + } + parent = op; + } while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML'); + + var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st); + + if (returnObject) { $.extend(returnObject, returnValue); return this; } + else { return returnValue; } + } +}); + +/** + * Handles converting a CSS Style into an Integer. + * @private + */ +var num = function(el, prop) { + return parseInt($.css(el.jquery?el[0]:el,prop))||0; +}; + +/** + * Handles the return value of the offset and offsetLite methods. + * @private + */ +var handleOffsetReturn = function(elem, options, x, y, sl, st) { + if ( !options.margin ) { + x -= num(elem, 'marginLeft'); + y -= num(elem, 'marginTop'); + } + + // Safari and Opera do not add the border for the element + if ( options.border && ($.browser.safari || $.browser.opera) ) { + x += num(elem, 'borderLeftWidth'); + y += num(elem, 'borderTopWidth'); + } else if ( !options.border && !($.browser.safari || $.browser.opera) ) { + x -= num(elem, 'borderLeftWidth'); + y -= num(elem, 'borderTopWidth'); + } + + if ( options.padding ) { + x += num(elem, 'paddingLeft'); + y += num(elem, 'paddingTop'); + } + + // do not include scroll offset on the element + if ( options.scroll ) { + sl -= elem.scrollLeft; + st -= elem.scrollTop; + } + + return options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl } + : { top: y, left: x }; +}; + +})(jQuery); \ No newline at end of file diff --git a/static/scripts/jquery.interface2.behavior.js b/static/scripts/jquery.interface2.behavior.js new file mode 100644 index 00000000000..4d68e466083 --- /dev/null +++ b/static/scripts/jquery.interface2.behavior.js @@ -0,0 +1,230 @@ + +(function($) { + //drag and drop manager + $.DDM = { + + //define a new draggable behavior + drag: function(el, options) { + el.DB = new $.dragBehavior(el, options); + }, + + //define a new droppable behavior + drop: function(el, options) { + el.DrB = new $.dropBehavior(el, options); + }, + + //drop targets + targets: [], + + //current pointer position + pointer: null, + + shiftKey: false, + altKey: false, + ctrlKey: false, + + //dragged element/elements + dragged: null, + + //timeout holder + preventionTimeout: null, + + mouseMove: function(e) { + if (!$.DDM.dragged) { + return false; + } + if (e) { + //store current event target + $.DDM.currentTarget = e.target; + + //store pointer position + $.DDM.pointer = $.DDM.dragged.DB.getPointer.apply($.DDM.dragged,[e]); + $.DDM.shiftKey = e.shiftKey; + $.DDM.altKey = e.altKey; + $.DDM.ctrlKey = e.ctrlKey; + } + + //if the pointer was not moved enough do not start the dragging action + if (!$.DDM.dragged.DB.dragThreshMet) { + var snap = Math.max( + Math.abs($.DDM.pointer.x - $.DDM.dragged.DB.pointer.x), + Math.abs($.DDM.pointer.y - $.DDM.dragged.DB.pointer.y) + ); + if (snap >= $.DDM.dragged.DB.snap) { + return $.DDM.startDrag(e); + } + return; + } + + $.DDM.dragged.DB.beforeDrag.apply($.DDM.dragged, [e]); + var toReturn = $.DDM.dragged.DB.drag.apply($.DDM.dragged, [e]); + + //checks if dragged element validates against drop targets + if ($.DDM.dragged.DB.hasTargets) { + for (var i=0; i< $.DDM.dragged.DB.targets.length; i++) { + $.DDM.dragged.DB.targets[i].DrB.checkTarget.apply($.DDM.dragged.DB.targets[i], [e]); + } + } + + if (toReturn === false) { + return false; + } + return; + }, + + mouseUp: function(e) { + if (!$.DDM.dragged) + return; + $.DDM.currentTarget = e.target; + var toReturn = true; + var dragged = $.DDM.dragged ; + clearTimeout($.DDM.preventionTimeout); + + //if the dragging action started + if (dragged.DB.dragThreshMet) { + dragged.DB.beforeStopDrag.apply(dragged,[e]); + toReturn = dragged.DB.stopDrag.apply(dragged,[e]); + } else { + if(dragged.DB.proxy) { $(dragged.DB.proxy).remove(); } + dragged.DB.onClickOnly.apply(dragged,[e]); + } + + $.DDM.clearTargets(e); + $.DDM.clearOptions(); + + $(document).unbind('mousemove', $.DDM.mouseMove); + $(document).unbind('mouseup', $.DDM.mouseUp); + + return toReturn; + }, + //start the dragging action + startDrag: function(e) { + if (!$.DDM.dragged) + return; + $.DDM.dragged.DB.dragThreshMet = true; + clearTimeout($.DDM.preventionTimeout ); + $.DDM.dragged.DB.beforeStartDrag.apply($.DDM.dragged, [e]); + + return $.DDM.dragged.DB.startDrag.apply($.DDM.dragged, [e]); + }, + + //check the drop targets and validate if are posibile targets for current dragged element + findTargets: function() { + $.DDM.dragged.DB.targets = []; + for( var i=0; i< $.DDM.targets.length; i++) { + for (var j in $.DDM.targets[i].DrB.groups) { + if ($.DDM.dragged.DB.groups[j] && $.DDM.targets[i].DrB.isTarget.apply($.DDM.targets[i])) { + $.DDM.targets[i].DrB.onActivate.apply($.DDM.targets[i]); + $.DDM.dragged.DB.targets[$.DDM.dragged.DB.targets.length] = $.DDM.targets[i]; + break; + } + } + } + $.DDM.dragged.DB.hasTargets = ($.DDM.dragged.DB.targets.length>0) ; + }, + + //clear the previously activated drop targets + clearTargets: function(e) { + for (var i=0; i< $.DDM.dragged.DB.targets.length; i++) { + $.DDM.dragged.DB.targets[i].DrB.onDeactivate.apply($.DDM.dragged.DB.targets[i], [e]); + } + $.DDM.dragged.DB.targets = []; + $.DDM.dragged.DB.hasTargets = false; + }, + + //clear all options stored in the dragging action + clearOptions: function() { + $.DDM.currentTarget = null; + $.DDM.dragged.DB.dragThreshMet = false; + $.DDM.dragged.DB.draggedEls = null; + $.DDM.dragged = null; + } + }; + + //drag behavior object + $.dragBehavior = function(el, options) { + this.init(el, options); + }; + + $.dragBehavior.prototype = { + draggedEls: null, + groups: {'default':true}, + size: null, + offset: null, + pointer: null, + proxy: null, + dragThreshMet: false, + preventionTimeout: 400, + beforeStartDrag: function(){}, + getPointer: function(e){return {x:e.pageX,y:e.pageY}}, + startDrag: function() {}, + beforeDrag: function(){}, + drag: function(){}, + beforeStopDrag: function(){}, + stopDrag: function(){}, + targets: [], + hasTargets: false, + snap: 0, + getDraggedEls: function(el) { + return el; + }, + init: function(el, options) { + $(el).bind('mousedown', this.mouseDown); + $.extend(this, options); + el.onselectstart = function(){return false;}; + el.ondrag = function(){return false;}; + el.unselectable = "on"; + }, + + mouseDown: function(e) { + if (!this.DB) { + return false; + } + $(document).bind('mousemove', $.DDM.mouseMove); + $(document).bind('mouseup', $.DDM.mouseUp); + $.DDM.currentTarget = e.target; + $.DDM.shiftKey = e.shiftKey; + $.DDM.altKey = e.altKey; + $.DDM.ctrlKey = e.ctrlKey; + this.DB.draggedEls = this.DB.getDraggedEls(this, e); + if (!this.DB.draggedEls) { + return; + } + $.DDM.dragged = this; + $.DDM.dragged.DB.dragThreshMet = false; + $.DDM.dragged.DB.pointer = $.DDM.pointer = {x:e.pageX, y:e.pageY}; + $.DDM.findTargets(); + if (this.DB.preventionTimeout) { + $.DDM.preventionTimeout = setTimeout(function(){$.DDM.startDrag(e)}, this.DB.preventionTimeout); + return false; + } + if (this.DB.snap) { + return false; + } + return $.DDM.startDrag(e); + } + }; + //drop behavior object + $.dropBehavior = function(el, options) { + this.init(el, options); + }; + $.dropBehavior.prototype = { + isTarget: function() {return false}, + onActivate: function(){}, + onDeactivate: function(){}, + checkTarget: function() {return false}, + onHover: function(){}, + onOut: function(){}, + onDrop: function(){}, + position: null, + size: null, + tolerance: 'pointer', + groups: {'default':true}, + isOver: false, + init: function(el, options) { + $.DDM.targets[$.DDM.targets.length] = el; + $.extend(this, options); + } + }; + + })(jQuery); \ No newline at end of file diff --git a/static/scripts/jquery.interface2.draggables.js b/static/scripts/jquery.interface2.draggables.js new file mode 100644 index 00000000000..d2d0cc13b29 --- /dev/null +++ b/static/scripts/jquery.interface2.draggables.js @@ -0,0 +1,249 @@ + +(function($) { + $.fn.draggable = function(options) { + options = $.extend({ + beforeDrag: function(e) { + var position, delta; + //if cursorAt then the element is positioned at cursor position + if (options.cursorAt) { + position = { + x: $.DDM.pointer.x + this.DB.extraOffset.x, + y: $.DDM.pointer.y + this.DB.extraOffset.y + } + } else { + delta = { + x: $.DDM.pointer.x - this.DB.pointer.x , + y: $.DDM.pointer.y - this.DB.pointer.y + } + + //apply grid + if (this.DB.grid) { + delta = this.DB.applyGrid(delta); + } + //if there are limits then recalculate delta + if (this.DB.limitOffset) { + delta = { + x: Math.max( + this.DB.limitOffset.x, + Math.min( + this.DB.position.x + delta.x, + this.DB.limitOffset.x + this.DB.limitOffset.w - this.DB.size.wb + )) - this.DB.position.x, + y: Math.max( + this.DB.limitOffset.y, + Math.min( + this.DB.position.y + delta.y, + this.DB.limitOffset.y + this.DB.limitOffset.h - this.DB.size.hb + ))-this.DB.position.y + }; + + } + position = { + x: this.DB.offset.x + delta.x, + y: this.DB.offset.y + delta.y + }; + } + if (this.DB.dragModifier) { + position = this.DB.dragModifier(position); + } + this.DB.onDrag.apply(this.DB.draggedEls, [this.DB.proxy||this.DB.draggedEls, position]); + $(this.DB.proxy||this.DB.draggedEls).css({ + left: position.x + 'px', + top: position.y + 'px' + }); + return false; + }, + beforeStartDrag: function() { + //get element position, offset position and size + this.DB.position = $.iUtil.getPosition(this.DB.draggedEls); + this.DB.size = $.iUtil.getSize(this.DB.draggedEls); + this.DB.offset = { + x: this.DB.draggedEls.offsetLeft, + y: this.DB.draggedEls.offsetTop + }; + /*this.DB.offset = { + x: parseInt($.curCSS(this.DB.draggedEls, 'left'), 10)||0, + y: parseInt($.curCSS(this.DB.draggedEls, 'top'), 10)||0 + };*/ + //if cursorAt then calculate the extra offset + if (this.DB.cursorAt) { + this.DB.extraOffset = { + x: this.DB.cursorAt.left ? + (this.DB.cursorAt.left * (-1)) + : this.DB.cursorAt.right ? + (- this.DB.size.wb + this.DB.cursorAt.right) + : 0, + y: this.DB.cursorAt.top ? + (this.DB.cursorAt.top * (-1)) + : this.DB.cursorAt.bottom ? + (- this.DB.size.hb + this.DB.cursorAt.bottom) + : 0 + }; + } + //if containment then calculates the limits + if (this.DB.containment) { + //if a node then get node position and size and calculate limits + if (this.DB.containment.parentNode) { + this.DB.limitOffset = $.extend( + $.iUtil.getPosition(this.DB.containment), + $.iUtil.getSize(this.DB.containment) + ); + this.DB.limitOffset.h = this.DB.limitOffset.hb; + this.DB.limitOffset.w = this.DB.limitOffset.wb; + //if document then get document size + } else if(this.DB.containment === 'document') { + var clientScroll = $.iUtil.getScroll(); + this.DB.limitOffset = { + x: 0, + y: 0, + h: Math.max(clientScroll.h,clientScroll.ih), + w: Math.max(clientScroll.w,clientScroll.iw) + }; + //if viewport then get document size and scroll + } else if(this.DB.containment === 'viewport') { + var clientScroll = $.iUtil.getScroll(); + this.DB.limitOffset = { + x: clientScroll.l, + y: clientScroll.t, + h: Math.min(clientScroll.h,clientScroll.ih), + w: Math.min(clientScroll.w,clientScroll.iw) + }; + } else { + this.DB.limitOffset = this.DB.containment; + } + } + var el = this.DB.proxy||this.DB.draggedEls; + + //store old zIndex value to restore later + if (options.zIndex) { + this.DB.oldZIndex = $.attr(el, 'zIndex'); + el.style.zIndex = 'number' == typeof options.zIndex ? options.zIndex : 1999; + } + + el.style.display = ''; + this.DB.beforeDrag.apply(this); + }, + startDrag: function() { + this.DB.onStart.apply(this.DB.draggedEls, [this.DB.proxy||this.DB.draggedEls, $.DDM.dragged.DB.targets]); + return false; + }, + //get pointer (overides the default fonction because of the axis option) + getPointer: function(e){ + return { + x : this.DB.axis === 'y' ? this.DB.pointer.x : e.pageX, + y : this.DB.axis === 'x' ? this.DB.pointer.y : e.pageY + }; + }, + beforeStopDrag: function() { + var handledByUser = this.DB.onStop.apply( + this.DB.draggedEls, + [ + this.DB.proxy||this.DB.draggedEls, + this.DB.revert ? + this.DB.offset : + ( + this.DB.proxy ? + {x:this.DB.proxy.offsetLeft,y:this.DB.proxy.offsetTop} + : + {x:this.DB.draggedEls.offsetLeft, y:this.DB.draggedEls.offsetTop} + ) + ]); + //if used chooses not to handle the stop dragging action then clear proxy and position teh element + if (handledByUser === false) { + if (this.DB.revert) { + $(this.DB.draggedEls).css({ + left: this.DB.offset.x + 'px', + top: this.DB.offset.y + 'px' + }); + } + if(this.DB.proxy) { + if (!this.DB.revert) { + $(this.DB.draggedEls).css({ + left: this.DB.proxy.offsetLeft + 'px', + top: this.DB.proxy.offsetTop + 'px' + }); + } + $(this.DB.proxy).remove(); + } + } + //reverse to the old zIndex + if (options.zIndex) { + this.DB.draggedEls.style.zIndex = this.DB.oldZIndex; + } + return false; + }, + getDraggedEls: function(el) { + //find element that needs to be dragged + var del = el.DB.toDrag||el, + isAllowed = true; + //if the event was fired by a illegal element or condition then stop the dragging + if ('function' == typeof options.dragPrevention) { + isAllowed = options.dragPrevention.apply(del,[$.DDM.currentTarget]); + } else if ('string' == typeof options.dragPrevention) { + var chunks = options.dragPrevention.toUpperCase().split(','); + jQuery.each( + chunks, + function() { + if ($.DDM.currentTarget.nodeName == this){ + isAllowed=false + } + } + ); + } + if (isAllowed == true) { + //if proxy is required add it to the DOM + if(options.ghostly || options.helper === 'clone') { + if (options.helper == 'clone') { + options.ghostly = true; + } + el.DB.proxy = $(del).clone(true).insertAfter(del).hide()[0]; + } else if (options.helper) { + el.DB.proxy = $(options.helper.apply(del)).hide()[0]; + } + if (el.DB.proxy) { + $(el.DB.proxy).css({ + top: $.curCSS(del, 'top'), + left: $.curCSS(del, 'left'), + display: 'none' + }); + } + return del; + } + return; + }, + //apply grid to current position + applyGrid: function(delta) { + return { + x: parseInt((delta.x + (this.grid.x* delta.x/Math.abs(delta.x))/2)/this.grid.x, 10) * this.grid.x, + y: parseInt((delta.y + (this.grid.y* delta.y/Math.abs(delta.y))/2)/this.grid.y, 10) * this.grid.y + }; + }, + onStart: function(){return false;}, + onStop: function(){return false;}, + onDrag: function(){return false;} + }, options||{}); + + return this.each(function(){ + var el = $(this); + //find the handle + var toDrag = this; + if (options.handle) { + el = $(options.handle, this); + if (el.size() == 0 ) + el = this; + } + + if (options.preventionDistance) { + options.snap = options.preventionDistance; + } + + //iterate each element and add drag behavior + el.each(function(){ + if (!this.DB) { + $.DDM.drag(this, options); + if (options.handle) this.DB.toDrag = toDrag; + } + }); + }); + }; + })(jQuery); \ No newline at end of file diff --git a/static/scripts/jquery.interface2.iutil.js b/static/scripts/jquery.interface2.iutil.js new file mode 100644 index 00000000000..9850fe97e56 --- /dev/null +++ b/static/scripts/jquery.interface2.iutil.js @@ -0,0 +1,297 @@ +/** + * Interface Elements for jQuery + * utility function + * + * http://interface.eyecon.ro + * + * Copyright (c) 2006 Stefan Petre + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * + */ + +jQuery.iUtil = { + getPosition : function(e, forceIt) + { + var x = 0; + var y = 0; + var es = e.style; + var restoreStyles = false; + if (forceIt && jQuery.curCSS(e,'display') == 'none') { + var oldVisibility = es.visibility; + var oldPosition = es.position; + restoreStyles = true; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + } + var el = e; + if (el.getBoundingClientRect) { // IE + var box = el.getBoundingClientRect(); + x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; + y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2; + } else { + x = el.offsetLeft; + y = el.offsetTop; + el = el.offsetParent; + if (e != el) { + while (el) { + x += el.offsetLeft; + y += el.offsetTop; + el = el.offsetParent; + } + } + if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) { + x -= document.body.offsetLeft; + y -= document.body.offsetTop; + } + el = e.parentNode; + while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') + { + if (jQuery.curCSS(el, 'display') != 'inline') { + x -= el.scrollLeft; + y -= el.scrollTop; + } + el = el.parentNode; + } + } + if (restoreStyles == true) { + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {x:x, y:y}; + }, + getPositionLite : function(el) + { + var x = 0, y = 0; + while(el) { + x += el.offsetLeft || 0; + y += el.offsetTop || 0; + el = el.offsetParent; + } + return {x:x, y:y}; + }, + getSize : function(e) + { + var w = parseInt(jQuery.curCSS(e,'width'), 10); + var h = parseInt(jQuery.curCSS(e,'height'), 10); + var wb = 0; + var hb = 0; + if (jQuery.curCSS(e, 'display') != 'none') { + wb = e.offsetWidth; + hb = e.offsetHeight; + } else { + var es = e.style; + var oldVisibility = es.visibility; + var oldPosition = es.position; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + wb = e.offsetWidth; + hb = e.offsetHeight; + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {w:w, h:h, wb:wb, hb:hb}; + }, + getSizeLite : function(el) + { + return { + wb:el.offsetWidth||0, + hb:el.offsetHeight||0 + }; + }, + getClient : function(e) + { + var h, w; + if (e) { + w = e.clientWidth; + h = e.clientHeight; + } else { + var de = document.documentElement; + w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + } + return {w:w,h:h}; + }, + getScroll : function (e) + { + var t=0, l=0, w=0, h=0, iw=0, ih=0; + if (e && e.nodeName.toLowerCase() != 'body') { + t = e.scrollTop; + l = e.scrollLeft; + w = e.scrollWidth; + h = e.scrollHeight; + } else { + if (document.body) { + t = document.body.scrollTop; + l = document.body.scrollLeft; + w = document.body.scrollWidth; + h = document.body.scrollHeight; + } else if (document.documentElement) { + t = document.documentElement.scrollTop; + l = document.documentElement.scrollLeft; + w = document.documentElement.scrollWidth; + h = document.documentElement.scrollHeight; + } + iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; + ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; + } + return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; + }, + getMargins : function(e, toInteger) + { + var t = jQuery.curCSS(e,'marginTop') || ''; + var r = jQuery.curCSS(e,'marginRight') || ''; + var b = jQuery.curCSS(e,'marginBottom') || ''; + var l = jQuery.curCSS(e,'marginLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPadding : function(e, toInteger) + { + var t = jQuery.curCSS(e,'paddingTop') || ''; + var r = jQuery.curCSS(e,'paddingRight') || ''; + var b = jQuery.curCSS(e,'paddingBottom') || ''; + var l = jQuery.curCSS(e,'paddingLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getBorder : function(e, toInteger) + { + var t = jQuery.curCSS(e,'borderTopWidth') || ''; + var r = jQuery.curCSS(e,'borderRightWidth') || ''; + var b = jQuery.curCSS(e,'borderBottomWidth') || ''; + var l = jQuery.curCSS(e,'borderLeftWidth') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10)||0 + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPointer : function(event) + { + var x = event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) || 0; + var y = event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) || 0; + return {x:x, y:y}; + }, + traverseDOM : function(nodeEl, func) + { + func(nodeEl); + nodeEl = nodeEl.firstChild; + while(nodeEl){ + jQuery.iUtil.traverseDOM(nodeEl, func); + nodeEl = nodeEl.nextSibling; + } + }, + purgeEvents : function(nodeEl) + { + jQuery.iUtil.traverseDOM( + nodeEl, + function(el) + { + for(var attr in el){ + if(typeof el[attr] === 'function') { + el[attr] = null; + } + } + } + ); + }, + getInnerWidth : function(el, scroll) { + var offsetW = el.offsetWidth; + return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth; + /*return (scroll ? Math.max(el.scrollWidth,el.offsetWidth) : el.offsetWidth) + - (parseInt($.curCSS(el, 'borderLeftWidth'), 10)||0) + - (parseInt($.curCSS(el, 'borderRightWidth'), 10)||0);*/ + }, + getInnerHeight : function(el, scroll) { + var offsetH = el.offsetHeight; + return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight; + /*return (scroll ? Math.max(el.scrollHeight,el.offsetHeight) : el.offsetHeight) + - (parseInt($.curCSS(el, 'borderTopWidth'), 10)||0) + - (parseInt($.curCSS(el, 'borderBottomWidth'), 10)||0);*/ + }, + getExtraWidth : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingLeft'), 10)||0) + + (parseInt($.curCSS(el, 'paddingRight'), 10)||0) + + (parseInt($.curCSS(el, 'borderLeftWidth'), 10)||0) + + (parseInt($.curCSS(el, 'borderRightWidth'), 10)||0); + return 0; + }, + getExtraHeight : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingTop'), 10)||0) + + (parseInt($.curCSS(el, 'paddingBottom'), 10)||0) + + (parseInt($.curCSS(el, 'borderTopWidth'), 10)||0) + + (parseInt($.curCSS(el, 'borderBottomWidth'), 10)||0); + return 0; + }, + isChildOf: function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (parentEl.contains && !$.browser.safari) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + centerEl : function(el, axis) + { + var clientScroll = $.iUtil.getScroll(); + var size = $.iUtil.getSize(el); + if (!axis || axis == 'vertically') + $(el).css( + { + top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px' + } + ); + if (!axis || axis == 'horizontally') + $(el).css( + { + left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px' + } + ); + } +}; + +// Helper function to support older browsers! +[].indexOf || (Array.prototype.indexOf = function(v, n){ + n = (n == null) ? 0 : n; + var m = this.length; + for (var i=n; i -