You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by sk...@apache.org on 2012/06/13 22:50:37 UTC
svn commit: r1350013 [3/5] - in /oodt/trunk: ./ balance/modules/puny/
balance/modules/puny/classes/ balance/modules/puny/classes/data/
balance/modules/puny/classes/parsers/ balance/modules/puny/data/
balance/modules/puny/data/resources/ balance/modules...
Added: oodt/trunk/balance/modules/puny/scripts/login.php
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/scripts/login.php?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/scripts/login.php (added)
+++ oodt/trunk/balance/modules/puny/scripts/login.php Wed Jun 13 20:50:35 2012
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Include the main Puny class
+require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
+
+// Get the configured editor username / password
+$punyUsername = App::Get()->settings['puny_editor_username'];
+$punyPassword = App::Get()->settings['puny_editor_password'];
+
+// Get the provided credentials from the POST request
+$username = $_POST['username'];
+$password = $_POST['password'];
+
+// Ensure that the editor credentials are properly configured in config.ini
+if ( !($punyUsername && $punyPassword) ) {
+ $_SESSION['puny_error'] = "Unable to launch Puny because the Puny "
+ . "admin credentials are not configured properly.";
+ App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
+}
+
+// Test the provided values against the configured values
+if ( $username == $punyUsername && $password == $punyPassword ) {
+ // Login success
+ Puny::initializeEditorSession();
+ App::get()->redirect(SITE_ROOT . '/');
+} else {
+ // Login Failure...
+ $_SESSION['puny_error'] = "Invalid editor credentials provided...";
+ App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
+}
+
+exit();
+
+
+
+
Added: oodt/trunk/balance/modules/puny/scripts/logout.php
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/scripts/logout.php?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/scripts/logout.php (added)
+++ oodt/trunk/balance/modules/puny/scripts/logout.php Wed Jun 13 20:50:35 2012
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Parse the Puny config file
+$module = App::Get()->loadModule();
+
+// Include the main Puny class
+require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
+
+// Destroy the editor session
+Puny::destroyEditorSession();
+
+// Redirect home
+App::Get()->redirect(SITE_ROOT . '/');
+
+exit();
+
Added: oodt/trunk/balance/modules/puny/scripts/store.php
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/scripts/store.php?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/scripts/store.php (added)
+++ oodt/trunk/balance/modules/puny/scripts/store.php Wed Jun 13 20:50:35 2012
@@ -0,0 +1,40 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Parse the Puny config file
+$module = App::Get()->loadModule();
+
+// Include the main Puny class
+require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
+
+// Get the resource id from the request parameters
+$resourceId = $_POST['resourceId'];
+$content = $_POST['content'];
+
+// Load the requested resource and update the content
+$resource = Puny::load($resourceId)->setContent($content);
+
+// Store the updated content as a new version
+Puny::store($resource);
+
+// we're done :)
+echo json_encode(array(
+ "status" => "ok"
+ , "resourceId" => $resourceId
+ , "version" => $resource->getVersion()
+ , "parsedContent" => $resource->parse()->getContent()));
Added: oodt/trunk/balance/modules/puny/static/css/defaults.css
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/css/defaults.css?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/css/defaults.css (added)
+++ oodt/trunk/balance/modules/puny/static/css/defaults.css Wed Jun 13 20:50:35 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@CHARSET "UTF-8";
+
+/* Puny Module Default Style */
+
+[puny] blockquote {
+ margin:20px 40px;
+}
+[puny] code {
+ font-family: monospace;
+}
+[puny] em {
+ font-style: italic;
+}
+[puny] ol {
+ list-style: decimal;
+}
+[puny] ul {
+ list-style: disc;
+}
+[puny] strong {
+ font-weight: bold;
+}
Added: oodt/trunk/balance/modules/puny/static/css/dialog.css
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/css/dialog.css?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/css/dialog.css (added)
+++ oodt/trunk/balance/modules/puny/static/css/dialog.css Wed Jun 13 20:50:35 2012
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @control dialog */
+
+#gollum-dialog-dialog {
+ display: block;
+ overflow: visible;
+ position: absolute;
+ left: 50%;
+}
+
+#gollum-dialog-dialog.active {
+ display: block;
+}
+
+#gollum-dialog-dialog-inner {
+ margin: 0 0 0 -225px;
+ position: relative;
+ width: 450px;
+
+ border: 7px solid #999;
+ border: 7px solid rgba(0, 0, 0, 0.3);
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+
+#gollum-dialog-dialog-bg {
+ background-color: #fff;
+ overflow: hidden;
+ padding: 1em;
+
+ background: -webkit-gradient(linear, left top, left bottom, from(#f7f7f7), to(#ffffff));
+ background: -moz-linear-gradient(top, #f7f7f7, #ffffff);
+}
+
+#gollum-dialog-dialog-inner h4 {
+ border-bottom: 1px solid #ddd;
+ color: #000;
+ font-size: 1.8em;
+ line-height: normal;
+ font-weight: bold;
+ margin: 0 0 0.75em 0;
+ padding: 0 0 0.3em 0;
+}
+
+#gollum-dialog-dialog-body {
+ font-size: 1.2em;
+ line-height: 1.6em;
+}
+
+#gollum-dialog-dialog-body fieldset {
+ display: block;
+ border: 0;
+ margin: 0;
+ overflow: hidden;
+ padding: 0;
+}
+
+#gollum-dialog-dialog-body fieldset .field {
+ margin: 0 0 1.5em 0;
+ padding: 0;
+}
+
+ #gollum-dialog-dialog-body fieldset .field label {
+ color: #000;
+ display: block;
+ font-size: 1.2em;
+ font-weight: bold;
+ line-height: 1.6em;
+ margin: 0;
+ padding: 0;
+ min-width: 80px;
+ }
+
+ #gollum-dialog-dialog-body fieldset .field input[type="text"] {
+ border: 1px solid #ddd;
+ display: block;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-size: 1.2em;
+ line-height: 1.6em;
+ margin: 0.3em 0 0 0;
+ padding: 0.3em 0.5em;
+ width: 96.5%;
+ }
+
+ #gollum-dialog-dialog-body fieldset .field input.code {
+ font-family: 'Monaco', 'Courier New', Courier, monospace;
+ }
+
+#gollum-dialog-dialog-body fieldset .field:last-child {
+ margin: 0 0 1em 0;
+}
+
+#gollum-dialog-dialog-buttons {
+ border-top: 1px solid #ddd;
+ overflow: hidden;
+ margin: 1.5em 0 0 0;
+ padding: 1em 0 0 0;
+}
+
+#gollum-dialog-dialog a.minibutton {
+ float: right;
+ margin-right: 0.5em;
+ width: auto;
+}
+
+#gollum-dialog-dialog a.minibutton,
+#gollum-dialog-dialog a.minibutton:visited {
+ background-color: #f7f7f7;
+ border: 1px solid #d4d4d4;
+ color: #333;
+ cursor: pointer;
+ display: block;
+ font-size: 1.2em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-weight: bold;
+ margin: 0 0 0 0.8em;
+ padding: 0.4em 1em;
+
+ text-shadow: 0 1px 0 #fff;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+}
+
+#gollum-dialog-dialog a.minibutton:hover {
+ background: #3072b3;
+ border-color: #518cc6 #518cc6 #2a65a0;
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
\ No newline at end of file
Added: oodt/trunk/balance/modules/puny/static/css/editor.css
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/css/editor.css?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/css/editor.css (added)
+++ oodt/trunk/balance/modules/puny/static/css/editor.css Wed Jun 13 20:50:35 2012
@@ -0,0 +1,567 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ editor.css
+ Wiki editor formatting
+*/
+
+a {
+ -moz-outline: none !important;
+}
+
+.jaws {
+ /* JAWS should see it, but you can't */
+ display: block;
+ height: 1px;
+ left: -5000px;
+ overflow: hidden;
+ position: absolute;
+ top: -5000px;
+ width: 1px;
+}
+
+#gollum-editor {
+ border: 1px solid #e4e4e4;
+ background: #f9f9f9;
+ margin: 1em 0 5em;
+ overflow: hidden;
+ padding: 1em 1em 0.4em;
+
+ border-radius: 1em;
+ -moz-border-radius: 1em;
+ -webkit-border-radius: 1em;
+}
+
+.ie #gollum-editor {
+ padding-bottom: 1em;
+}
+
+#gollum-editor form fieldset {
+ border: 0;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+
+#gollum-editor .singleline {
+ display: block;
+ margin: 0 0 0.7em 0;
+ overflow: hidden;
+}
+
+#gollum-editor .singleline input {
+ background: #fff;
+ border: 1px solid #ddd;
+ color: #000;
+ font-size: 1.3em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ line-height: 1.8em;
+ margin: 1em 0 0.4em;
+ padding: 0.5em;
+ width: 98%;
+}
+
+#gollum-editor .singleline input.ph {
+ color: #999;
+}
+
+#gollum-editor-title-field input#gollum-editor-page-title {
+ font-weight: bold;
+ margin-top: 0;
+}
+
+#gollum-editor-title-field.active {
+ border-bottom: 1px solid #ddd;
+ display: block;
+ margin: 0 0 0.3em 0;
+ padding: 0 0 0.5em 0;
+}
+
+#gollum-editor-title-field input#gollum-editor-page-title.ph {
+ color: #000;
+}
+
+/* @control editor-view-tab */
+#gollum-editor #gollum-editor-type-switcher {
+ display: none;
+}
+
+/* @control function-bar */
+#gollum-editor #gollum-editor-function-bar {
+ border-bottom: 1px solid #ddd;
+ overflow: hidden;
+ padding: 0;
+}
+
+
+#gollum-editor-title-field + #gollum-editor-function-bar {
+ margin-top: 0.6em;
+}
+
+#gollum-editor #gollum-editor-function-bar #gollum-editor-function-buttons {
+ /* display: none; */
+}
+
+#gollum-editor #gollum-editor-function-bar.active #gollum-editor-function-buttons {
+ display: block;
+ float: left;
+ overflow: hidden;
+ padding: 0 0 1.1em 0;
+}
+
+#gollum-editor #gollum-editor-function-bar a.function-button {
+ background: #f7f7f7;
+ border: 1px solid #ddd;
+ color: #333;
+ display: block;
+ float: left;
+ height: 25px;
+ overflow: hidden;
+ margin: 0.2em 0.5em 0 0;
+ /* text-indent: -5000px; */
+ text-shadow: 0 1px 0 #fff;
+ width: 25px;
+
+ border-radius: 0.3em;
+ -moz-border-radius: 0.3em;
+ -webkit-border-radius: 0.3em;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+}
+
+#gollum-editor #gollum-editor-function-bar a.function-button:hover {
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
+
+#gollum-editor #gollum-editor-function-bar a span {
+ background-image: url(../img/icon-sprite.png);
+ background-repeat: no-repeat;
+ display: block;
+ height: 25px;
+ overflow: hidden;
+ text-indent: -5000px;
+ width: 25px;
+}
+
+a#function-bold span { background-position: 0 0; }
+a#function-italic span { background-position: -27px 0; }
+a#function-underline span { background-position: -54px 0; }
+a#function-code span { background-position: -82px 0; }
+a#function-ul span { background-position: -109px 0; }
+a#function-ol span { background-position: -136px 0; }
+a#function-blockquote span { background-position: -163px 0; }
+a#function-hr span { background-position: -190px 0; }
+a#function-h1 span { background-position: -217px 0; }
+a#function-h2 span { background-position: -244px 0; }
+a#function-h3 span { background-position: -271px 0; }
+a#function-link span { background-position: -298px 0; }
+a#function-image span { background-position: -324px 0; }
+a#function-help span { background-position: -405px 0; }
+
+a#function-bold:hover span { background-position: 0 -28px; }
+a#function-italic:hover span { background-position: -27px -28px; }
+a#function-underline:hover span { background-position: -54px -28px; }
+a#function-code:hover span { background-position: -82px -28px; }
+a#function-ul:hover span { background-position: -109px -28px; }
+a#function-ol:hover span { background-position: -136px -28px; }
+a#function-blockquote:hover span { background-position: -163px -28px; }
+a#function-hr:hover span { background-position: -190px -28px; }
+a#function-h1:hover span { background-position: -217px -28px; }
+a#function-h2:hover span { background-position: -244px -28px; }
+a#function-h3:hover span { background-position: -271px -28px; }
+a#function-link:hover span { background-position: -298px -28px; }
+a#function-image:hover span { background-position: -324px -28px; }
+a#function-help:hover span { background-position: -405px -28px; }
+
+
+#gollum-editor #gollum-editor-function-bar a.disabled {
+ display: none;
+}
+
+#gollum-editor #gollum-editor-function-bar span.function-divider {
+ display: block;
+ float: left;
+ width: 0.5em;
+}
+
+#gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector {
+ overflow: hidden;
+ padding: 0 0 1.1em 0;
+}
+
+#gollum-editor #gollum-editor-function-bar
+ #gollum-editor-format-selector select {
+ background-color: #f9f9f9;
+ border: 1px solid transparent;
+
+ float: right;
+ font-size: 1.1em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-weight: bold;
+ line-height: 1.6em;
+ padding: 0.5em 0.7em;
+ margin-bottom: 0;
+
+
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+ -moz-outline: none;
+}
+
+#gollum-editor #gollum-editor-function-bar
+ #gollum-editor-format-selector select:hover {
+ background-color: #fff;
+ border: 1px solid #ddd;
+ -moz-outline: none;
+}
+
+#gollum-editor #gollum-editor-function-bar
+ #gollum-editor-format-selector label {
+ color: #999;
+ float: right;
+ font-size: 1.1em;
+ font-weight: bold;
+ line-height: 1.6em;
+ padding: 0.6em 0.5em 0 0;
+}
+
+#gollum-editor #gollum-editor-function-bar
+ #gollum-editor-format-selector label:after {
+ content: ':';
+}
+
+
+/* @section form-fields */
+
+body {
+font: 13px Helvetica,arial,freesans,clean,sans-serif;
+line-height: 1.4;
+color: #333;
+position: relative;
+padding: 0;
+width: 100%;
+z-index: 9;
+display: block;
+margin: 0 auto;
+}
+
+#gollum-editor textarea#gollum-editor-body {
+ background: #fff;
+ border: 1px solid #ddd;
+ font-size: 1.3em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ line-height: 1.8em;
+ margin: 1em 0 0.4em;
+ padding: 0.5em; /* I don't really like mixing pct & em hereĆ */
+ width: 100%;
+ height: 20em;
+}
+
+#gollum-editor input.gollum-editor-input {
+ background-color: #f7f7f7;
+ border: 1px solid #d4d4d4;
+ color: #333;
+ cursor: pointer;
+ display: block;
+ float: left;
+ font-size: 1.2em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-weight: bold;
+ height: 35px;
+ margin: 0px 5px;
+ padding: 0.4em 1em;
+
+ text-shadow: 0 1px 0 #fff;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+}
+
+.webkit #gollum-editor input#gollum-editor-submit {
+ padding: 0.5em 1em 0.45em;
+}
+
+.ie #gollum-editor input#gollum-editor-submit {
+ padding: 0.4em 1em 0.5em;
+}
+
+#gollum-editor input#gollum-editor-submit:hover {
+ background: #3072b3;
+ border-color: #518cc6 #518cc6 #2a65a0;
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
+
+#gollum-editor .collapsed,
+#gollum-editor .expanded {
+ border-bottom: 1px solid #ddd;
+ display: block;
+ overflow: hidden;
+ padding: 1em 0 0.5em;
+}
+
+#gollum-editor #gollum-editor-body + .collapsed,
+#gollum-editor #gollum-editor-body + .expanded {
+ border-top: 1px solid #ddd;
+ margin-top: 0.7em;
+}
+
+#gollum-editor .collapsed a.button,
+#gollum-editor .expanded a.button {
+ background: #f7f7f7;
+ border: 1px solid #ddd;
+ color: #333;
+ display: block;
+ float: left;
+ height: 25px;
+ overflow: hidden;
+ margin: 0.2em 0.5em 0.75em 0;
+ text-shadow: 0 1px 0 #fff;
+ width: 25px;
+
+ border-radius: 0.3em;
+ -moz-border-radius: 0.3em;
+ -webkit-border-radius: 0.3em;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+}
+
+#gollum-editor .collapsed h4,
+#gollum-editor .expanded h4 {
+ font-size: 1.6em;
+ float: left;
+ margin: 0;
+ padding: 0.4em 0 0 0.3em;
+ text-shadow: 0 -1px 0 #fff;
+}
+
+#gollum-editor .collapsed a.button:hover,
+#gollum-editor .expanded h4 a.button:hover {
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
+
+#gollum-editor .collapsed a span,
+#gollum-editor .expanded a span {
+ background-image: url(../img/icon-sprite.png);
+ background-position: -351px -1px;
+ background-repeat: no-repeat;
+ display: block;
+ height: 25px;
+ overflow: hidden;
+ text-indent: -5000px;
+ width: 25px;
+}
+
+#gollum-editor .collapsed a:hover span {
+ background-position: -351px -28px;
+}
+
+#gollum-editor .expanded a span {
+ background-position: -378px 0;
+}
+
+#gollum-editor .expanded a:hover span {
+ background-position: -378px -28px;
+}
+
+#gollum-editor .collapsed textarea {
+ display: none;
+}
+
+#gollum-editor .expanded textarea {
+ background-color: #fff;
+ border: 1px solid #ddd;
+ clear: both;
+ display: block;
+ font-size: 1.3em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ height: 7em;
+ line-height: 1.8em;
+ margin: 0.7em 0;
+ padding: 0.5em;
+ width: 98%;
+}
+
+/* @control minibutton */
+
+#gollum-editor a.minibutton,
+#gollum-editor a.minibutton:visited {
+ background-color: #f7f7f7;
+ border: 1px solid #d4d4d4;
+ color: #333;
+ cursor: pointer;
+ display: block;
+ font-size: 1.2em;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-weight: bold;
+ line-height: 1.2em;
+ margin: 0 0 0 0.8em;
+ padding: 0.5em 1em;
+
+ text-shadow: 0 1px 0 #fff;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+}
+
+#gollum-editor a.minibutton:hover {
+ background: #3072b3;
+ border-color: #518cc6 #518cc6 #2a65a0;
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
+
+
+#gollum-editor #gollum-editor-preview {
+ float: left;
+ font-weight: normal;
+ padding: left;
+}
+
+
+/* @section help */
+#gollum-editor-help {
+ margin: 0;
+ overflow: hidden;
+ padding: 0;
+ border: 1px solid #ddd;
+ border-width: 0 1px 1px 1px;
+}
+
+ #gollum-editor-help-parent,
+ #gollum-editor-help-list {
+ display: block;
+ float: left;
+ height: 17em;
+ list-style-type: none;
+ overflow: auto;
+ margin: 0;
+ padding: 1em 0;
+ width: 18%;
+ }
+
+ #gollum-editor-help-parent {
+ border-right: 1px solid #eee;
+ }
+
+ #gollum-editor-help-list {
+ background: #fafafa;
+ border-right: 1px solid #eee;
+ }
+
+ #gollum-editor-help-parent li,
+ #gollum-editor-help-list li {
+ font-size: 1.2em;
+ line-height: 1.6em;
+ margin: 0;
+ padding: 0;
+ }
+
+ #gollum-editor-help-parent li a,
+ #gollum-editor-help-list li a {
+ border: 1px solid transparent;
+ border-width: 1px 0;
+ display: block;
+ font-weight: bold;
+ height: 10%;
+ width: auto;
+ padding: 0.2em 1em;
+ text-shadow: 0 -1px 0 #fff;
+ }
+
+ #gollum-editor-help-parent li a:hover,
+ #gollum-editor-help-list li a:hover {
+ background: #fff;
+ border-color: #f0f0f0;
+ text-decoration: none;
+
+ box-shadow: none;
+ }
+
+ #gollum-editor-help-parent li a.selected,
+ #gollum-editor-help-list li a.selected {
+ border: 1px solid #eee;
+ border-bottom-color: #e7e7e7;
+ border-width: 1px 0;
+ background: #fff;
+ color: #000;
+
+ box-shadow: 0 1px 2px #f0f0f0;
+ }
+
+ #gollum-editor-help-wrapper {
+ background: #fff;
+ overflow: auto;
+ height: 17em;
+ padding: 1em;
+ }
+
+ #gollum-editor-help-content {
+ font-size: 1.2em;
+ margin: 0 1em 0 0.5em;
+ padding: 0;
+ line-height: 1.8em;
+ }
+
+ #gollum-editor-help-content p {
+ margin: 0 0 1em 0;
+ padding: 0;
+ }
+
+/* IE */
+.ie #gollum-editor .singleline input {
+ padding-top: 0.25em;
+ padding-bottom: 0.75em;
+}
Added: oodt/trunk/balance/modules/puny/static/css/github.css
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/css/github.css?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/css/github.css (added)
+++ oodt/trunk/balance/modules/puny/static/css/github.css Wed Jun 13 20:50:35 2012
@@ -0,0 +1,677 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#wiki-wrapper #template blockquote {
+ margin: 1em 0;
+ border-left: 4px solid #ddd;
+ padding-left: .8em;
+ color: #555;
+}
+
+/*
+ gollum.css
+ A basic stylesheet for Gollum
+*/
+
+/* @section core */
+body, html {
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 10px;
+ margin: 0;
+ padding: 0;
+}
+
+#wiki-wrapper {
+ margin: 0 auto;
+ overflow: visible;
+ width: 90%;
+}
+
+a:link {
+ color: #4183c4;
+ text-decoration: none;
+}
+
+a:hover, a:visited {
+ color: #4183c4;
+ text-decoration: underline;
+}
+
+
+/* @section head */
+#head {
+ margin: 4.5em 0 0.5em;
+ padding: 0.5em 0;
+ overflow: hidden;
+}
+
+ #head h1 {
+ /* display: none; */
+ }
+
+ #head ul.actions {
+ float: right;
+ }
+
+/* @section content */
+#wiki-content {
+ height: 1%;
+ overflow: visible;
+}
+
+ #wiki-content .wrap {
+ height: 1%;
+ overflow: auto;
+ }
+
+ /* @section comments */
+ #wiki-body #inline-comment {
+ display: none; /* todo */
+ }
+
+ /* @section body */
+ #wiki-body {
+ display: block;
+ float: left;
+ margin-right: 3%;
+ width: 100%;
+ }
+
+ .has-rightbar #wiki-body {
+ width: 68%;
+ }
+
+ /* @section rightbar */
+ #wiki-rightbar {
+ background-color: #f7f7f7;
+ border: 1px solid #ddd;
+ font-size: 13px;
+ float: right;
+ padding: 7px;
+ width: 25%;
+
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+ }
+
+ #wiki-rightbar p {
+ margin: 13px 0 0;
+ }
+
+ #wiki-rightbar > p:first-child {
+ margin-top: 0;
+ }
+
+ #wiki-rightbar p.parent {
+ border-bottom: 1px solid #bbb;
+ font-weight: bold;
+ margin: 0 0 0.5em 0;
+ padding: 0 0 0.5em 0;
+ text-shadow: 0 1px 0 #fff;
+ }
+
+ /* Back arrow */
+ #wiki-rightbar p.parent:before {
+ color: #666;
+ content: "<-- ";
+ }
+
+ #wiki-rightbar h3 {
+ font-size: 1.2em;
+ color: #333;
+ margin: 1.2em 0 0;
+ padding: 0;
+ text-shadow: 0 1px 0 #fff;
+ }
+
+ #wiki-rightbar ul {
+ margin: 0.5em 0 1em;
+ padding: 0;
+ }
+
+ #wiki-rightbar ul li {
+ color: #bbb;
+ margin: 0 0 0 1em;
+ padding: 0;
+ line-height: 1.75em;
+ list-style-position: inside;
+ list-style-type: round;
+ }
+
+ #wiki-rightbar #nav ul li a {
+ font-weight: bold;
+ text-shadow: 0 1px 0 #fff;
+ }
+
+ /* @section footer */
+ #wiki-footer {
+ clear: both;
+ margin: 2em 0 5em;
+ }
+
+ .has-rightbar #wiki-footer {
+ width: 70%;
+ }
+
+ #wiki-footer #footer-content {
+ background-color: #f7f7f7;
+ border: 1px solid #ddd;
+ font-size: 1.2em;
+ line-height: 1.5em;
+ margin-top: 1.5em;
+ padding: 1em;
+
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+ }
+
+ #wiki-footer #footer-content h3 {
+ font-size: 1.2em;
+ color: #333;
+ margin: 0;
+ padding: 0 0 0.2em;
+ text-shadow: 0 1px 0 #fff;
+ }
+
+ #wiki-footer #footer-content p {
+ margin: 0.5em 0 0;
+ padding: 0;
+ }
+
+ #wiki-footer #footer-content ul.links {
+ margin: 0.5em 0 0;
+ overflow: hidden;
+ padding: 0;
+ }
+
+ #wiki-footer #footer-content ul.links li {
+ color: #999;
+ float: left;
+ list-style-position: inside;
+ list-style-type: square;
+ padding: 0;
+ margin-left: 0.75em;
+ }
+
+ #wiki-footer #footer-content ul.links li a {
+ font-weight: bold;
+ text-shadow: 0 1px 0 #fff;
+ }
+
+ #wiki-footer #footer-content ul.links li:first-child {
+ list-style-type: none;
+ margin: 0;
+ }
+
+ .ff #wiki-footer #footer-content ul.links li:first-child {
+ margin: 0 -0.75em 0 0;
+ }
+
+ /* @section page-footer */
+ .page #footer {
+ margin: 1em 0 7em;
+ }
+
+ #footer p#last-edit {
+ font-size: .9em;
+ line-height: 1.6em;
+ color: #999;
+ margin: 0.9em 0;
+ }
+
+ #footer p#last-edit span.username {
+ font-weight: bold;
+ }
+
+
+/* @section history */
+.history h1 {
+ color: #999;
+ font-weight: normal;
+}
+
+ .history h1 strong {
+ color: #000;
+ font-weight: bold;
+ }
+
+#wiki-history {
+ margin-top: 3em;
+}
+
+ #wiki-history fieldset {
+ border: 0;
+ margin: 2em 0;
+ padding: 0;
+ }
+
+ #wiki-history table, #wiki-history tbody {
+ border-collapse: collapse;
+ padding: 0;
+ margin: 0;
+ width: 100%;
+ }
+
+ #wiki-history table tr {
+ padding: 0;
+ margin: 0;
+ }
+
+ #wiki-history table tr {
+ background-color: #ebf2f6;
+ }
+
+ #wiki-history table tr td {
+ border: 1px solid #c0dce9;
+ font-size: 1.2em;
+ line-height: 1.6em;
+ margin: 0;
+ padding: 0.3em 0.7em;
+ }
+
+ #wiki-history table tr td.checkbox {
+ min-width: 2em;
+ padding: 0.3em;
+ }
+
+ #wiki-history table tr td.checkbox input {
+ cursor: pointer;
+ display: block;
+ padding-right: 0;
+ padding-top: 0.4em;
+ margin-right: -0.2em;
+ }
+
+ #wiki-history table tr:nth-child(2n),
+ #wiki-history table tr.alt-row {
+ background-color: #f3f7fa;
+ }
+
+ #wiki-history table tr.selected {
+ background-color: #ffffea !important;
+ z-index: 100;
+ }
+
+ #wiki-history table tr td.commit-name {
+ border-left: 0;
+ }
+
+ #wiki-history table tr td.commit-name span.time-elapsed {
+ color: #999;
+ }
+
+ #wiki-history table tr td.author {
+ width: 20%;
+ }
+
+ #wiki-history table tr td.author a {
+ color: #000;
+ font-weight: bold;
+ }
+
+ #wiki-history table tr td.author a span.username {
+ display: block;
+ padding-top: 3px;
+ }
+
+ #wiki-history table tr td img {
+ background-color: #fff;
+ border: 1px solid #999;
+ display: block;
+ float: left;
+ height: 18px;
+ overflow: hidden;
+ margin: 0 0.5em 0 0;
+ width: 18px;
+ padding: 2px;
+ }
+
+ #wiki-history table tr td.commit-name a {
+ font-size: 0.9em;
+ font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
+ padding: 0 0.2em;
+ }
+
+.history #wiki-history ul.actions li,
+.history #footer ul.actions li {
+ margin: 0 0.6em 0 0;
+}
+
+
+/* @section edit */
+.edit h1 {
+ color: #999;
+ font-weight: normal;
+}
+
+ .edit h1 strong {
+ color: #000;
+ font-weight: bold;
+ }
+
+
+/* @section search */
+.results h1 {
+ color: #999;
+ font-weight: normal;
+}
+
+ .results h1 strong {
+ color: #000;
+ font-weight: bold;
+ }
+
+ .results #results {
+ border-bottom: 1px solid #ccc;
+ margin-bottom: 2em;
+ padding-bottom: 2em;
+ }
+
+ .results #results ul {
+ margin: 2em 0 0 0;
+ padding: 0;
+ }
+
+ .results #results ul li {
+ font-size: 1.2em;
+ line-height: 1.6em;
+ list-style-position: outside;
+ padding: 0.2em 0;
+ }
+
+ .results #results ul li span.count {
+ color: #999;
+ }
+
+ .results p#no-results {
+ font-size: 1.2em;
+ line-height: 1.6em;
+ margin-top: 2em;
+ }
+
+ .results #footer ul.actions li {
+ margin: 0 1em 0 0;
+ }
+
+
+/* @section compare */
+.compare h1 {
+ color: #999;
+ font-weight: normal;
+}
+
+ .compare h1 strong {
+ color: #000;
+ font-weight: bold;
+ }
+
+ .compare #compare-content {
+ margin-top: 3em;
+ }
+
+ .compare .data {
+ border: 1px solid #ddd;
+ margin-top: 1em;
+ overflow: auto;
+ }
+
+ .compare .data pre {
+ margin: 0;
+ padding: 0;
+ }
+
+ .compare .data pre div {
+ padding: 0 0 0 1em;
+ }
+
+ .compare .data tr td {
+ font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
+ font-size: 1.2em;
+ line-height: 1.8em;
+ margin: 0;
+ padding: 0;
+ }
+
+ .compare .data td.line_numbers {
+ background: #f7f7f7;
+ border-right: 1px solid #999;
+ color: #999;
+ padding: 0 0 0 0.5em;
+ }
+
+.compare #compare-content ul.actions li,
+.compare #footer ul.actions li {
+ margin-left: 0;
+ margin-right: 0.6em;
+}
+
+
+
+/* @control syntax */
+.highlight { background: #ffffff; }
+.highlight .c { color: #999988; font-style: italic }
+.highlight .err { color: #a61717; background-color: #e3d2d2 }
+.highlight .k { font-weight: bold }
+.highlight .o { font-weight: bold }
+.highlight .cm { color: #999988; font-style: italic }
+.highlight .cp { color: #999999; font-weight: bold }
+.highlight .c1 { color: #999988; font-style: italic }
+.highlight .cs { color: #999999; font-weight: bold; font-style: italic }
+.highlight .gd { color: #000000; background-color: #ffdddd }
+.highlight .gd .x { color: #000000; background-color: #ffaaaa }
+.highlight .ge { font-style: italic }
+.highlight .gr { color: #aa0000 }
+.highlight .gh { color: #999999 }
+.highlight .gi { color: #000000; background-color: #ddffdd }
+.highlight .gi .x { color: #000000; background-color: #aaffaa }
+.highlight .gc { color: #999; background-color: #EAF2F5 }
+.highlight .go { color: #888888 }
+.highlight .gp { color: #555555 }
+.highlight .gs { font-weight: bold }
+.highlight .gu { color: #aaaaaa }
+.highlight .gt { color: #aa0000 }
+
+
+/* @control minibutton */
+ul.actions {
+ display: block;
+ list-style-type: none;
+ overflow: hidden;
+ padding: 0;
+}
+
+ ul.actions li {
+ float: left;
+ font-size: 1.2em;
+ margin-left: 0.6em;
+ }
+
+.minibutton a {
+ background-color: #f7f7f7;
+ border: 1px solid #d4d4d4;
+ color: #333;
+ display: block;
+ font-weight: bold;
+ margin: 0;
+ padding: 0.4em 1em;
+ height: 1.4em;
+
+ text-shadow: 0 1px 0 #fff;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+}
+
+#search-submit {
+ background-color: #f7f7f7;
+ border: 1px solid #d4d4d4;
+ color: #333;
+ display: block;
+ font-weight: bold;
+ margin: 0;
+ padding: 0.4em 1em;
+
+ text-shadow: 0 1px 0 #fff;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
+ background: -moz-linear-gradient(top, #f4f4f4, #ececec);
+
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+}
+
+.minibutton a:hover,
+#search-submit:hover {
+ background: #3072b3;
+ border-color: #518cc6 #518cc6 #2a65a0;
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ text-decoration: none;
+
+ filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
+ background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
+ background: -moz-linear-gradient(top, #599bdc, #3072b3);
+}
+
+.minibutton a:visited {
+ text-decoration: none;
+}
+
+
+/* @special error */
+#wiki-wrapper.error {
+ height: 1px;
+ position: absolute;
+ overflow: visible;
+ top: 50%;
+ width: 100%;
+}
+
+#error {
+ background-color: #f9f9f9;
+ border: 1px solid #e4e4e4;
+ left: 50%;
+ overflow: hidden;
+ padding: 2%;
+ margin: -10% 0 0 -35%;
+ position: absolute;
+ width: 70%;
+
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+}
+
+#error h1 {
+ font-size: 3em;
+ line-height: normal;
+ margin: 0;
+ padding: 0;
+}
+
+#error p {
+ font-size: 1.2em;
+ line-height: 1.6em;
+ margin: 1em 0 0.5em;
+ padding: 0;
+}
+
+
+/* @control searchbar */
+#head #searchbar {
+ float: right;
+ margin: 1em 0 0 0;
+ padding: 0;
+ overflow: hidden;
+}
+
+ #head #searchbar #searchbar-fauxtext {
+ background: #fff;
+ border: 1px solid #d4d4d4;
+ overflow: hidden;
+
+ border-radius: 0.3em;
+ -moz-border-radius: 0.3em;
+ -webkit-border-radius: 0.3em;
+ }
+
+ #head #searchbar #searchbar-fauxtext input#search-query {
+ border: none;
+ color: #000;
+ float: left;
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-size: 1.2em;
+ height: 1.8em;
+
+ -webkit-focus-ring: none;
+ }
+
+ .ff #head #searchbar #searchbar-fauxtext input#search-query {
+ padding: 0.2em 0 0.2em 0.5em;
+ }
+
+ .ie #head #searchbar #searchbar-fauxtext input#search-query {
+ padding: 0.4em 0 0 0.5em;
+ }
+
+ #head #searchbar #searchbar-fauxtext input#search-query.ph {
+ color: #999;
+ }
+
+ #head #searchbar #searchbar-fauxtext #search-submit {
+ border: 0;
+ border-left: 1px solid #d4d4d4;
+ cursor: pointer;
+ margin: 0 !important;
+ padding: 0;
+ float: right;
+ font-size: 1.2em;
+
+ border-radius: 0 3px 3px 0;
+ -moz-border-radius: 0 3px 3px 0;
+ -webkit-border-radius: 0 3px 3px 0;
+ }
+
+ #head #searchbar #searchbar-fauxtext #search-submit span {
+ background-image: url(/images/icon-sprite.png);
+ background-position: -431px -1px;
+ background-repeat: no-repeat;
+ display: block;
+ height: 2em;
+ overflow: hidden;
+ text-indent: -5000px;
+ width: 28px;
+ }
+
+ .ff #head #searchbar #searchbar-fauxtext #search-submit span,
+ .ie #head #searchbar #searchbar-fauxtext #search-submit span {
+ height: 2.2em;
+ }
+
+ #head #searchbar #searchbar-fauxtext #search-submit:hover span {
+ background-position: -431px -28px;
+ padding: 0;
+ }
Added: oodt/trunk/balance/modules/puny/static/css/puny.css
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/css/puny.css?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/css/puny.css (added)
+++ oodt/trunk/balance/modules/puny/static/css/puny.css Wed Jun 13 20:50:35 2012
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@CHARSET "UTF-8";
+
+[puny] {
+
+ background-color:#fcfae6 !important;
+ color:#222 !important;
+
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+
+[puny] a {
+ color:#225 !important;
+}
Added: oodt/trunk/balance/modules/puny/static/img/icon-sprite.png
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/img/icon-sprite.png?rev=1350013&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/balance/modules/puny/static/img/icon-sprite.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/balance/modules/puny/static/js/editable.js
URL: http://svn.apache.org/viewvc/oodt/trunk/balance/modules/puny/static/js/editable.js?rev=1350013&view=auto
==============================================================================
--- oodt/trunk/balance/modules/puny/static/js/editable.js (added)
+++ oodt/trunk/balance/modules/puny/static/js/editable.js Wed Jun 13 20:50:35 2012
@@ -0,0 +1,1090 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * gollum.editor.js
+ * A jQuery plugin that creates the Gollum Editor.
+ *
+ * Usage:
+ * $.GollumEditor(); on DOM ready.
+ */
+(function($) {
+
+ // Editor options
+ var DefaultOptions = {
+ MarkupType: 'markdown',
+ EditorMode: 'code',
+ NewFile: false,
+ HasFunctionBar: true,
+ Debug: false,
+ NoDefinitionsFor: []
+ };
+ var ActiveOptions = {};
+
+ /**
+ * $.GollumEditor
+ *
+ * You don't need to do anything. Just run this on DOM ready.
+ */
+ $.GollumEditor = function( IncomingOptions ) {
+
+ ActiveOptions = $.extend( DefaultOptions, IncomingOptions );
+
+ debug('GollumEditor loading');
+
+ if ( EditorHas.baseEditorMarkup() ) {
+
+ if ( EditorHas.titleDisplayed() ) {
+ $('#gollum-editor-title-field').addClass('active');
+ }
+
+ if ( EditorHas.editSummaryMarkup() ) {
+ $.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
+ $('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
+ e.preventDefault();
+ $.GollumEditor.Placeholder.clearAll();
+ debug('submitting');
+ $(this).unbind('submit');
+ $(this).submit();
+ });
+ }
+
+ if ( EditorHas.collapsibleInputs() ) {
+ $('#gollum-editor .collapsed a.button, ' +
+ '#gollum-editor .expanded a.button').click(function( e ) {
+ e.preventDefault();
+ $(this).parent().toggleClass('expanded');
+ $(this).parent().toggleClass('collapsed');
+ });
+ }
+
+ if ( EditorHas.previewButton() ) {
+ var formAction =
+ $('#gollum-editor #gollum-editor-preview').click(function() {
+ // make a dummy form, submit to new target window
+ // get form fields
+ var oldAction = $('#gollum-editor form').attr('action');
+ var $form = $($('#gollum-editor form').get(0));
+ $form.attr('action', this.href || '/preview');
+ $form.attr('target', '_blank');
+ $form.submit();
+
+
+ $form.attr('action', oldAction);
+ $form.removeAttr('target');
+ return false;
+ });
+ }
+
+ // Initialize the function bar by loading proper definitions
+ if ( EditorHas.functionBar() ) {
+
+ var htmlSetMarkupLang =
+ $('#gollum-editor-body').attr('data-markup-lang');
+
+ if ( htmlSetMarkupLang ) {
+ ActiveOptions.MarkupType = htmlSetMarkupLang;
+ }
+
+ // load language definition
+ LanguageDefinition.setActiveLanguage( ActiveOptions.MarkupType );
+ if ( EditorHas.formatSelector() ) {
+ FormatSelector.init(
+ $('#gollum-editor-format-selector select') );
+ }
+
+ if ( EditorHas.help() ) {
+ $('#gollum-editor-help').hide();
+ $('#gollum-editor-help').removeClass('jaws');
+ }
+
+ }
+ // EditorHas.functionBar
+ }
+ // EditorHas.baseEditorMarkup
+ };
+
+
+
+ /**
+ * $.GollumEditor.defineLanguage
+ * Defines a set of language actions that Gollum can use.
+ * Used by the definitions in langs/ to register language definitions.
+ */
+ $.GollumEditor.defineLanguage = function( language_name, languageObject ) {
+ if ( typeof languageObject == 'object' ) {
+ LanguageDefinition.define( language_name, languageObject );
+ } else {
+ debug('GollumEditor.defineLanguage: definition for ' + language_name +
+ ' is not an object');
+ }
+ };
+
+
+ /**
+ * debug
+ * Prints debug information to console.log if debug output is enabled.
+ *
+ * @param mixed Whatever you want to dump to console.log
+ * @return void
+ */
+ var debug = function(m) {
+ if ( ActiveOptions.Debug &&
+ typeof console != 'undefined' ) {
+ console.log( m );
+ }
+ };
+
+
+
+ /**
+ * LanguageDefinition
+ * Language definition file handler
+ * Loads language definition files as necessary.
+ */
+ var LanguageDefinition = {
+
+ _ACTIVE_LANG: '',
+ _LOADED_LANGS: [],
+ _LANG: {},
+
+ /**
+ * Defines a language
+ *
+ * @param name string The name of the language
+ * @param name object The definition object
+ */
+ define: function( name, definitionObject ) {
+ LanguageDefinition._ACTIVE_LANG = name;
+ LanguageDefinition._LOADED_LANGS.push( name );
+ if ( typeof $.GollumEditor.WikiLanguage == 'object' ) {
+ var definition = {};
+ $.extend(definition, $.GollumEditor.WikiLanguage, definitionObject);
+ LanguageDefinition._LANG[name] = definition;
+ } else {
+ LanguageDefinition._LANG[name] = definitionObject;
+ }
+ },
+
+ getActiveLanguage: function() {
+ return LanguageDefinition._ACTIVE_LANG;
+ },
+
+ setActiveLanguage: function( name ) {
+ if ( !LanguageDefinition.isLoadedFor(name) ) {
+ LanguageDefinition._ACTIVE_LANG = null;
+ LanguageDefinition.loadFor( name, function(x, t) {
+ if ( t != 'success' ) {
+ debug('Failed to load language definition for ' + name);
+ // well, fake it and turn everything off for this one
+ LanguageDefinition.define( name, {} );
+ }
+
+ // update features that rely on the language definition
+ if ( EditorHas.functionBar() ) {
+ FunctionBar.refresh();
+ }
+
+ if ( LanguageDefinition.isValid() && EditorHas.formatSelector() ) {
+ FormatSelector.updateSelected();
+ }
+
+ } );
+ } else {
+ LanguageDefinition._ACTIVE_LANG = name;
+ FunctionBar.refresh();
+ }
+ },
+
+
+ /**
+ * gets a definition object for a specified attribute
+ *
+ * @param string attr The specified attribute.
+ * @param string specified_lang The language to pull a definition for.
+ * @return object if exists, null otherwise
+ */
+ getDefinitionFor: function( attr, specified_lang ) {
+ if ( !specified_lang ) {
+ specified_lang = LanguageDefinition._ACTIVE_LANG;
+ }
+
+ if ( LanguageDefinition.isLoadedFor(specified_lang) &&
+ LanguageDefinition._LANG[specified_lang][attr] &&
+ typeof LanguageDefinition._LANG[specified_lang][attr] == 'object' ) {
+ return LanguageDefinition._LANG[specified_lang][attr];
+ }
+
+ return null;
+ },
+
+
+ /**
+ * loadFor
+ * Asynchronously loads a definition file for the current markup.
+ * Definition files are necessary to use the code editor.
+ *
+ * @param string markup_name The markup name you want to load
+ * @return void
+ */
+ loadFor: function( markup_name, on_complete ) {
+ // Keep us from hitting 404s on our site, check the definition blacklist
+ if ( ActiveOptions.NoDefinitionsFor.length ) {
+ for ( var i=0; i < ActiveOptions.NoDefinitionsFor.length; i++ ) {
+ if ( markup_name == ActiveOptions.NoDefinitionsFor[i] ) {
+ // we don't have this. get out.
+ if ( typeof on_complete == 'function' ) {
+ on_complete( null, 'error' );
+ return;
+ }
+ }
+ }
+ }
+
+ // attempt to load the definition for this language
+ var script_uri = '/javascript/editor/langs/' + markup_name + '.js';
+ $.ajax({
+ url: script_uri,
+ dataType: 'script',
+ complete: function( xhr, textStatus ) {
+ if ( typeof on_complete == 'function' ) {
+ on_complete( xhr, textStatus );
+ }
+ }
+ });
+ },
+
+
+ /**
+ * isLoadedFor
+ * Checks to see if a definition file has been loaded for the
+ * specified markup language.
+ *
+ * @param string markup_name The name of the markup.
+ * @return boolean
+ */
+ isLoadedFor: function( markup_name ) {
+ if ( LanguageDefinition._LOADED_LANGS.length === 0 ) {
+ return false;
+ }
+
+ for ( var i=0; i < LanguageDefinition._LOADED_LANGS.length; i++ ) {
+ if ( LanguageDefinition._LOADED_LANGS[i] == markup_name ) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ isValid: function() {
+ return ( LanguageDefinition._ACTIVE_LANG &&
+ typeof LanguageDefinition._LANG[LanguageDefinition._ACTIVE_LANG] ==
+ 'object' );
+ }
+
+ };
+
+
+ /**
+ * EditorHas
+ * Various conditionals to check what features of the Gollum Editor are
+ * active/operational.
+ */
+ var EditorHas = {
+
+
+ /**
+ * EditorHas.baseEditorMarkup
+ * True if the basic editor form is in place.
+ *
+ * @return boolean
+ */
+ baseEditorMarkup: function() {
+ return ( $('#gollum-editor').length &&
+ $('#gollum-editor-body').length );
+ },
+
+
+ /**
+ * EditorHas.collapsibleInputs
+ * True if the editor contains collapsible inputs for things like the
+ * sidebar or footer, false otherwise.
+ *
+ * @return boolean
+ */
+ collapsibleInputs: function() {
+ return $('#gollum-editor .collapsed, #gollum-editor .expanded').length;
+ },
+
+
+ /**
+ * EditorHas.formatSelector
+ * True if the editor has a format selector (for switching between
+ * language types), false otherwise.
+ *
+ * @return boolean
+ */
+ formatSelector: function() {
+ return $('#gollum-editor-format-selector select').length;
+ },
+
+
+ /**
+ * EditorHas.functionBar
+ * True if the Function Bar markup exists.
+ *
+ * @return boolean
+ */
+ functionBar: function() {
+ return ( ActiveOptions.HasFunctionBar &&
+ $('#gollum-editor-function-bar').length );
+ },
+
+
+ /**
+ * EditorHas.ff4Environment
+ * True if in a Firefox 4.0 Beta environment.
+ *
+ * @return boolean
+ */
+ ff4Environment: function() {
+ var ua = new RegExp(/Firefox\/4.0b/);
+ return ( ua.test( navigator.userAgent ) );
+ },
+
+
+ /**
+ * EditorHas.editSummaryMarkup
+ * True if the editor has a summary field (Gollum's commit message),
+ * false otherwise.
+ *
+ * @return boolean
+ */
+ editSummaryMarkup: function() {
+ return ( $('input#gollum-editor-message-field').length > 0 );
+ },
+
+
+ /**
+ * EditorHas.help
+ * True if the editor contains the inline help sector, false otherwise.
+ *
+ * @return boolean
+ */
+ help: function() {
+ return ( $('#gollum-editor #gollum-editor-help').length &&
+ $('#gollum-editor #function-help').length );
+ },
+
+
+ /**
+ * EditorHas.previewButton
+ * True if the editor has a preview button, false otherwise.
+ *
+ * @return boolean
+ */
+ previewButton: function() {
+ return ( $('#gollum-editor #gollum-editor-preview').length );
+ },
+
+
+ /**
+ * EditorHas.titleDisplayed
+ * True if the editor is displaying a title field, false otherwise.
+ *
+ * @return boolean
+ */
+ titleDisplayed: function() {
+ return ( ActiveOptions.NewFile );
+ }
+
+ };
+
+
+ /**
+ * FunctionBar
+ *
+ * Things the function bar does.
+ */
+ var FunctionBar = {
+
+ isActive: false,
+
+
+ /**
+ * FunctionBar.activate
+ * Activates the function bar, attaching all click events
+ * and displaying the bar.
+ *
+ */
+ activate: function() {
+ debug('Activating function bar');
+
+ // check these out
+ $('#gollum-editor-function-bar a.function-button').each(function() {
+ if ( LanguageDefinition.getDefinitionFor( $(this).attr('id') ) ) {
+ $(this).click( FunctionBar.evtFunctionButtonClick );
+ $(this).removeClass('disabled');
+ }
+ else if ( $(this).attr('id') != 'function-help' ) {
+ $(this).addClass('disabled');
+ }
+ });
+
+ // show bar as active
+ $('#gollum-editor-function-bar').addClass( 'active' );
+ FunctionBar.isActive = true;
+ },
+
+
+ deactivate: function() {
+ $('#gollum-editor-function-bar a.function-button').unbind('click');
+ $('#gollum-editor-function-bar').removeClass( 'active' );
+ FunctionBar.isActive = false;
+ },
+
+
+ /**
+ * FunctionBar.evtFunctionButtonClick
+ * Event handler for the function buttons. Traps the click and
+ * executes the proper language action.
+ *
+ * @param jQuery.Event jQuery event object.
+ */
+ evtFunctionButtonClick: function(e) {
+ e.preventDefault();
+ var def = LanguageDefinition.getDefinitionFor( $(this).attr('id') );
+ if ( typeof def == 'object' ) {
+ FunctionBar.executeAction( def );
+ }
+ },
+
+
+ /**
+ * FunctionBar.executeAction
+ * Executes a language-specific defined action for a function button.
+ *
+ */
+ executeAction: function( definitionObject ) {
+ // get the selected text from the textarea
+ var txt = $('#gollum-editor-body').val();
+ // hmm, I'm not sure this will work in a textarea
+ var selPos = FunctionBar
+ .getFieldSelectionPosition( $('#gollum-editor-body') );
+ var selText = FunctionBar.getFieldSelection( $('#gollum-editor-body') );
+ var repText = selText;
+ var reselect = true;
+ var cursor = null;
+
+ // execute a replacement function if one exists
+ if ( definitionObject.exec &&
+ typeof definitionObject.exec == 'function' ) {
+ definitionObject.exec( txt, selText, $('#gollum-editor-body') );
+ return;
+ }
+
+ // execute a search/replace if they exist
+ var searchExp = /([^\n]+)/gi;
+ if ( definitionObject.search &&
+ typeof definitionObject.search == 'object' ) {
+ debug('Replacing search Regex');
+ searchExp = null;
+ searchExp = new RegExp ( definitionObject.search );
+ debug( searchExp );
+ }
+ debug('repText is ' + '"' + repText + '"');
+ // replace text
+ if ( definitionObject.replace &&
+ typeof definitionObject.replace == 'string' ) {
+ debug('Running replacement - using ' + definitionObject.replace);
+ var rt = definitionObject.replace;
+ repText = repText.replace( searchExp, rt );
+ // remove backreferences
+ repText = repText.replace( /\$[\d]/g, '' );
+
+ if ( repText === '' ) {
+ debug('Search string is empty');
+
+ // find position of $1 - this is where we will place the cursor
+ cursor = rt.indexOf('$1');
+
+ // we have an empty string, so just remove backreferences
+ repText = rt.replace( /\$[\d]/g, '' );
+
+ // if the position of $1 doesn't exist, stick the cursor in
+ // the middle
+ if ( cursor == -1 ) {
+ cursor = Math.floor( rt.length / 2 );
+ }
+ }
+ }
+
+ // append if necessary
+ if ( definitionObject.append &&
+ typeof definitionObject.append == 'string' ) {
+ if ( repText == selText ) {
+ reselect = false;
+ }
+ repText += definitionObject.append;
+ }
+
+ if ( repText ) {
+ FunctionBar.replaceFieldSelection( $('#gollum-editor-body'),
+ repText, reselect, cursor );
+ }
+
+ },
+
+
+ /**
+ * getFieldSelectionPosition
+ * Retrieves the selection range for the textarea.
+ *
+ * @return object the .start and .end offsets in the string
+ */
+ getFieldSelectionPosition: function( $field ) {
+ if ($field.length) {
+ var start = 0, end = 0;
+ var el = $field.get(0);
+
+ if (typeof el.selectionStart == "number" &&
+ typeof el.selectionEnd == "number") {
+ start = el.selectionStart;
+ end = el.selectionEnd;
+ } else {
+ var range = document.selection.createRange();
+ var stored_range = range.duplicate();
+ stored_range.moveToElementText( el );
+ stored_range.setEndPoint( 'EndToEnd', range );
+ start = stored_range.text.length - range.text.length;
+ end = start + range.text.length;
+
+ // so, uh, we're close, but we need to search for line breaks and
+ // adjust the start/end points accordingly since IE counts them as
+ // 2 characters in TextRange.
+ var s = start;
+ var lb = 0;
+ var i;
+ debug('IE: start position is currently ' + s);
+ for ( i=0; i < s; i++ ) {
+ if ( el.value.charAt(i).match(/\r/) ) {
+ ++lb;
+ }
+ }
+
+ if ( lb ) {
+ debug('IE start: compensating for ' + lb + ' line breaks');
+ start = start - lb;
+ lb = 0;
+ }
+
+ var e = end;
+ for ( i=0; i < e; i++ ) {
+ if ( el.value.charAt(i).match(/\r/) ) {
+ ++lb;
+ }
+ }
+
+ if ( lb ) {
+ debug('IE end: compensating for ' + lb + ' line breaks');
+ end = end - lb;
+ }
+ }
+
+ return {
+ start: start,
+ end: end
+ };
+ } // end if ($field.length)
+ },
+
+
+ /**
+ * getFieldSelection
+ * Returns the currently selected substring of the textarea.
+ *
+ * @param jQuery A jQuery object for the textarea.
+ * @return string Selected string.
+ */
+ getFieldSelection: function( $field ) {
+ var selStr = '';
+ var selPos;
+
+ if ( $field.length ) {
+ selPos = FunctionBar.getFieldSelectionPosition( $field );
+ selStr = $field.val().substring( selPos.start, selPos.end );
+ debug('Selected: ' + selStr + ' (' + selPos.start + ', ' +
+ selPos.end + ')');
+ return selStr;
+ }
+ return false;
+ },
+
+
+ isShown: function() {
+ return ($('#gollum-editor-function-bar').is(':visible'));
+ },
+
+ refresh: function() {
+ if ( EditorHas.functionBar() ) {
+ debug('Refreshing function bar');
+ if ( LanguageDefinition.isValid() ) {
+ $('#gollum-editor-function-bar a.function-button').unbind('click');
+ FunctionBar.activate();
+ if ( Help ) {
+ Help.setActiveHelp( LanguageDefinition.getActiveLanguage() );
+ }
+ } else {
+ debug('Language definition is invalid.');
+ if ( FunctionBar.isShown() ) {
+ // deactivate the function bar; it's not gonna work now
+ FunctionBar.deactivate();
+ }
+ if ( Help.isShown() ) {
+ Help.hide();
+ }
+ }
+ }
+ },
+
+
+ /**
+ * replaceFieldSelection
+ * Replaces the currently selected substring of the textarea with
+ * a new string.
+ *
+ * @param jQuery A jQuery object for the textarea.
+ * @param string The string to replace the current selection with.
+ * @param boolean Reselect the new text range.
+ */
+ replaceFieldSelection: function( $field, replaceText, reselect, cursorOffset ) {
+ var selPos = FunctionBar.getFieldSelectionPosition( $field );
+ var fullStr = $field.val();
+ var selectNew = true;
+ if ( reselect === false) {
+ selectNew = false;
+ }
+
+ var scrollTop = null;
+ if ( $field[0].scrollTop ) {
+ scrollTop = $field[0].scrollTop;
+ }
+
+ $field.val( fullStr.substring(0, selPos.start) + replaceText +
+ fullStr.substring(selPos.end) );
+ $field[0].focus();
+
+ if ( selectNew ) {
+ if ( $field[0].setSelectionRange ) {
+ if ( cursorOffset ) {
+ $field[0].setSelectionRange(
+ selPos.start + cursorOffset,
+ selPos.start + cursorOffset
+ );
+ } else {
+ $field[0].setSelectionRange( selPos.start,
+ selPos.start + replaceText.length );
+ }
+ } else if ( $field[0].createTextRange ) {
+ var range = $field[0].createTextRange();
+ range.collapse( true );
+ if ( cursorOffset ) {
+ range.moveEnd( selPos.start + cursorOffset );
+ range.moveStart( selPos.start + cursorOffset );
+ } else {
+ range.moveEnd( 'character', selPos.start + replaceText.length );
+ range.moveStart( 'character', selPos.start );
+ }
+ range.select();
+ }
+ }
+
+ if ( scrollTop ) {
+ // this jumps sometimes in FF
+ $field[0].scrollTop = scrollTop;
+ }
+ }
+ };
+
+
+
+ /**
+ * FormatSelector
+ *
+ * Functions relating to the format selector (if it exists)
+ */
+ var FormatSelector = {
+
+ $_SELECTOR: null,
+
+ /**
+ * FormatSelector.evtChangeFormat
+ * Event handler for when a format has been changed by the format
+ * selector. Will automatically load a new language definition
+ * via JS if necessary.
+ *
+ * @return void
+ */
+ evtChangeFormat: function( e ) {
+ var newMarkup = $(this).val();
+ LanguageDefinition.setActiveLanguage( newMarkup );
+ },
+
+
+ /**
+ * FormatSelector.init
+ * Initializes the format selector.
+ *
+ * @return void
+ */
+ init: function( $sel ) {
+ debug('Initializing format selector');
+
+ // unbind events if init is being called twice for some reason
+ if ( FormatSelector.$_SELECTOR &&
+ typeof FormatSelector.$_SELECTOR == 'object' ) {
+ FormatSelector.$_SELECTOR.unbind( 'change' );
+ }
+
+ FormatSelector.$_SELECTOR = $sel;
+
+ // set format selector to the current language
+ FormatSelector.updateSelected();
+ FormatSelector.$_SELECTOR.change( FormatSelector.evtChangeFormat );
+ },
+
+
+ /**
+ * FormatSelector.update
+ */
+ updateSelected: function() {
+ var currentLang = LanguageDefinition.getActiveLanguage();
+ FormatSelector.$_SELECTOR.val( currentLang );
+ }
+
+ };
+
+
+
+ /**
+ * Help
+ *
+ * Functions that manage the display and loading of inline help files.
+ */
+ var Help = {
+
+ _ACTIVE_HELP: '',
+ _LOADED_HELP_LANGS: [],
+ _HELP: {},
+
+ /**
+ * Help.define
+ *
+ * Defines a new help context and enables the help function if it
+ * exists in the Gollum Function Bar.
+ *
+ * @param string name The name you're giving to this help context.
+ * Generally, this should match the language name.
+ * @param object definitionObject The definition object being loaded from a
+ * language / help definition file.
+ * @return void
+ */
+ define: function( name, definitionObject ) {
+ if ( Help.isValidHelpFormat( definitionObject ) ) {
+ debug('help is a valid format');
+
+ Help._ACTIVE_HELP_LANG = name;
+ Help._LOADED_HELP_LANGS.push( name );
+ Help._HELP[name] = definitionObject;
+
+ if ( $("#function-help").length ) {
+ if ( $('#function-help').hasClass('disabled') ) {
+ $('#function-help').removeClass('disabled');
+ }
+ $('#function-help').unbind('click');
+ $('#function-help').click( Help.evtHelpButtonClick );
+
+ // generate help menus
+ Help.generateHelpMenuFor( name );
+
+ if ( $('#gollum-editor-help').length &&
+ typeof $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
+ $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
+ Help.show();
+ }
+ }
+ } else {
+ if ( $('#function-help').length ) {
+ $('#function-help').addClass('disabled');
+ }
+ }
+ },
+
+ /**
+ * Help.generateHelpMenuFor
+ * Generates the markup for the main help menu given a context name.
+ *
+ * @param string name The context name.
+ * @return void
+ */
+ generateHelpMenuFor: function( name ) {
+ if ( !Help._HELP[name] ) {
+ debug('Help is not defined for ' + name.toString());
+ return false;
+ }
+ var helpData = Help._HELP[name];
+
+ // clear this shiz out
+ $('#gollum-editor-help-parent').html('');
+ $('#gollum-editor-help-list').html('');
+ $('#gollum-editor-help-content').html('');
+
+ // go go inefficient algorithm
+ for ( var i=0; i < helpData.length; i++ ) {
+ if ( typeof helpData[i] != 'object' ) {
+ break;
+ }
+
+ var $newLi = $('<li><a href="#" rel="' + i + '">' +
+ helpData[i].menuName + '</a></li>');
+ $('#gollum-editor-help-parent').append( $newLi );
+ if ( i === 0 ) {
+ // select on first run
+ $newLi.children('a').addClass('selected');
+ }
+ $newLi.children('a').click( Help.evtParentMenuClick );
+ }
+
+ // generate parent submenu on first run
+ Help.generateSubMenu( helpData[0], 0 );
+ $($('#gollum-editor-help-list li a').get(0)).click();
+
+ },
+
+ /**
+ * Help.generateSubMenu
+ * Generates the markup for the inline help sub-menu given the data
+ * object for the submenu and the array index to start at.
+ *
+ * @param object subData The data for the sub-menu.
+ * @param integer index The index clicked on (parent menu index).
+ * @return void
+ */
+ generateSubMenu: function( subData, index ) {
+ $('#gollum-editor-help-list').html('');
+ $('#gollum-editor-help-content').html('');
+ for ( var i=0; i < subData.content.length; i++ ) {
+ if ( typeof subData.content[i] != 'object' ) {
+ break;
+ }
+
+ var $subLi = $('<li><a href="#" rel="' + index + ':' + i + '">' +
+ subData.content[i].menuName + '</a></li>');
+
+
+ $('#gollum-editor-help-list').append( $subLi );
+ $subLi.children('a').click( Help.evtSubMenuClick );
+ }
+ },
+
+ hide: function() {
+ if ( $.browser.msie ) {
+ $('#gollum-editor-help').css('display', 'none');
+ } else {
+ $('#gollum-editor-help').animate({
+ opacity: 0
+ }, 200, function() {
+ $('#gollum-editor-help')
+ .animate({ height: 'hide' }, 200);
+ });
+ }
+ },
+
+ show: function() {
+ if ( $.browser.msie ) {
+ // bypass effects for internet explorer, since it does weird crap
+ // to text antialiasing with opacity animations
+ $('#gollum-editor-help').css('display', 'block');
+ } else {
+ $('#gollum-editor-help').animate({
+ height: 'show'
+ }, 200, function() {
+ $('#gollum-editor-help')
+ .animate({ opacity: 1 }, 300);
+ });
+ }
+ },
+
+ /**
+ * Help.showHelpFor
+ * Displays the actual help content given the two menu indexes, which are
+ * rendered in the rel="" attributes of the help menus
+ *
+ * @param integer index1 parent index
+ * @param integer index2 submenu index
+ * @return void
+ */
+ showHelpFor: function( index1, index2 ) {
+ var html =
+ Help._HELP[Help._ACTIVE_HELP_LANG][index1].content[index2].data;
+ $('#gollum-editor-help-content').html(html);
+ },
+
+ /**
+ * Help.isLoadedFor
+ * Returns true if help is loaded for a specific markup language,
+ * false otherwise.
+ *
+ * @param string name The name of the markup language.
+ * @return boolean
+ */
+ isLoadedFor: function( name ) {
+ for ( var i=0; i < Help._LOADED_HELP_LANGS.length; i++ ) {
+ if ( name == Help._LOADED_HELP_LANGS[i] ) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ isShown: function() {
+ return ($('#gollum-editor-help').is(':visible'));
+ },
+
+ /**
+ * Help.isValidHelpFormat
+ * Does a quick check to make sure that the help definition isn't in a
+ * completely messed-up format.
+ *
+ * @param object (Array) helpArr The help definition array.
+ * @return boolean
+ */
+ isValidHelpFormat: function( helpArr ) {
+ return ( typeof helpArr == 'object' &&
+ helpArr.length &&
+ typeof helpArr[0].menuName == 'string' &&
+ typeof helpArr[0].content == 'object' &&
+ helpArr[0].content.length );
+ },
+
+ /**
+ * Help.setActiveHelp
+ * Sets the active help definition to the one defined in the argument,
+ * re-rendering the help menu to match the new definition.
+ *
+ * @param string name The name of the help definition.
+ * @return void
+ */
+ setActiveHelp: function( name ) {
+ if ( !Help.isLoadedFor( name ) ) {
+ if ( $('#function-help').length ) {
+ $('#function-help').addClass('disabled');
+ }
+ if ( Help.isShown() ) {
+ Help.hide();
+ }
+ } else {
+ Help._ACTIVE_HELP_LANG = name;
+ if ( $("#function-help").length ) {
+ if ( $('#function-help').hasClass('disabled') ) {
+ $('#function-help').removeClass('disabled');
+ }
+ $('#function-help').unbind('click');
+ $('#function-help').click( Help.evtHelpButtonClick );
+ Help.generateHelpMenuFor( name );
+ }
+ }
+ },
+
+ /**
+ * Help.evtHelpButtonClick
+ * Event handler for clicking the help button in the function bar.
+ *
+ * @param jQuery.Event e The jQuery event object.
+ * @return void
+ */
+ evtHelpButtonClick: function( e ) {
+ e.preventDefault();
+ if ( Help.isShown() ) {
+ // turn off autodisplay if it's on
+ if ( $('#gollum-editor-help').length &&
+ $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
+ $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
+ $.post('/wiki/help?_method=delete');
+ $('#gollum-editor-help').attr('data-autodisplay', '');
+ }
+ Help.hide(); }
+ else { Help.show(); }
+ },
+
+ /**
+ * Help.evtParentMenuClick
+ * Event handler for clicking on an item in the parent menu. Automatically
+ * renders the submenu for the parent menu as well as the first result for
+ * the actual plain text.
+ *
+ * @param jQuery.Event e The jQuery event object.
+ * @return void
+ */
+ evtParentMenuClick: function( e ) {
+ e.preventDefault();
+ // short circuit if we've selected this already
+ if ( $(this).hasClass('selected') ) { return; }
+
+ // populate from help data for this
+ var helpIndex = $(this).attr('rel');
+ var subData = Help._HELP[Help._ACTIVE_HELP_LANG][helpIndex];
+
+ $('#gollum-editor-help-parent li a').removeClass('selected');
+ $(this).addClass('selected');
+ Help.generateSubMenu( subData, helpIndex );
+ $($('#gollum-editor-help-list li a').get(0)).click();
+ },
+
+ /**
+ * Help.evtSubMenuClick
+ * Event handler for clicking an item in a help submenu. Renders the
+ * appropriate text for the submenu link.
+ *
+ * @param jQuery.Event e The jQuery event object.
+ * @return void
+ */
+ evtSubMenuClick: function( e ) {
+ e.preventDefault();
+ if ( $(this).hasClass('selected') ) { return; }
+
+ // split index rel data
+ var rawIndex = $(this).attr('rel').split(':');
+ $('#gollum-editor-help-list li a').removeClass('selected');
+ $(this).addClass('selected');
+ Help.showHelpFor( rawIndex[0], rawIndex[1] );
+ }
+ };
+
+ // Publicly-accessible function to Help.define
+ $.GollumEditor.defineHelp = Help.define;
+
+ // Dialog exists as its own thing now
+ $.GollumEditor.Dialog = $.GollumDialog;
+ $.GollumEditor.replaceSelection = function( repText ) {
+ FunctionBar.replaceFieldSelection( $('#gollum-editor-body'), repText );
+ };
+
+ // Placeholder exists as its own thing now
+ $.GollumEditor.Placeholder = $.GollumPlaceholder;
+
+})(jQuery);