summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Great Git Migration2008-09-01 20:21:09 (GMT)
committer The Great Git Migration2008-09-01 20:21:09 (GMT)
commitbc01eedd90d91488a4dd1723ddd3455f6177b699 (patch)
treed3f2db3c04d20949625219ba7e67a9ff22e7be0b
parent8e2376a63d272be66bff73613ef0265cd9066d0d (diff)
This commit was manufactured as part of Drupal's Great Git Migration to
create branch 'DRUPAL-6--1'. Cherrypick from master 2008-09-01 20:21:08 UTC young hahn <yhahn@264833.no-reply.drupal.org> 'Merging fix for blocks in custom regions from DRUPAL-5 branch': context_ui/context_ui.css context_ui/context_ui.js
-rw-r--r--context_ui/context_ui.css193
-rw-r--r--context_ui/context_ui.js116
2 files changed, 309 insertions, 0 deletions
diff --git a/context_ui/context_ui.css b/context_ui/context_ui.css
new file mode 100644
index 0000000..6afe0df
--- /dev/null
+++ b/context_ui/context_ui.css
@@ -0,0 +1,193 @@
+/**
+ * Context devel block ================================================
+ */
+.context-devel-space {
+ font-weight:bold;
+ padding:3px 5px;
+ background:#369; color:#fff;
+}
+
+.context-devel-tree {
+ border-right:1px solid #69c;
+ border-bottom:1px solid #69c;
+}
+
+.context-devel-wrapper {
+ border-left:1px solid #69c;
+}
+
+.context-devel-wrapper .context-devel-wrapper {
+ border-left:8px solid #69c;
+}
+
+.context-devel-wrapper label {
+ display:block;
+ border-top:1px solid #69c;
+ padding: 5px;
+}
+
+.context-devel-wrapper small {
+ font-weight:normal; float:right;
+ font-size:8px; line-height:14px; padding:0px 3px;
+ background:#333; color:#ccc;
+}
+
+/**
+ * Context admin listing page =========================================
+ */
+table.context-ui span.context-namespace {
+ font-weight:bold;
+}
+
+table.context-ui span.context-attribute {
+ margin-left:2em;
+}
+
+table.context-ui span.context-value {
+ margin-left:4em;
+}
+
+table.context-ui span.overridden {
+ color:#9ab;
+}
+
+h3.context-space small {
+ display:inline;
+ padding:.1em .5em; margin-left:1em;
+ font-size:.6em; font-weight:bold;
+ text-transform:uppercase;
+ background:#e8f0f8; /* Garland blue */
+}
+
+/**
+ * Context definition editing form ====================================
+ */
+
+/* General table styles */
+form#context-ui-form table {
+ margin:0em 0em 1em;
+}
+
+ form#context-ui-form table td {
+ padding:.75em;
+ vertical-align:top;
+ }
+
+ form#context-ui-form table.context-ui-3col td {
+ width:33%;
+ }
+
+ form#context-ui-form table.context-ui-2col td {
+ width:50%;
+ }
+
+ form#context-ui-form table td.left {
+ border-right:1px solid #ace;
+ }
+
+ form#context-ui-form table tr.even .form-item,
+ form#context-ui-form table tr.odd .form-item {
+ white-space:normal;
+ }
+
+/* Set/get items */
+form#context-ui-form td.setters select,
+form#context-ui-form td.getters select,
+form#context-ui-form td.setters input.form-text,
+form#context-ui-form td.getters input.form-text {
+ width:90%;
+ }
+
+form#context-ui-form td.setters .form-item,
+form#context-ui-form td.getters .form-item {
+ background:#e8f0f8;
+ border-bottom: 1px solid #ace;
+ padding: 1em; margin:0em;
+}
+
+ form#context-ui-form td.setters .form-item .form-item,
+ form#context-ui-form td.getters .form-item .form-item {
+ background: transparent;
+ border:0px; padding:0px; margin:0px;
+ }
+
+ form#context-ui-form td.setters .form-item div.form-checkboxes,
+ form#context-ui-form td.getters .form-item div.form-checkboxes,
+ form#context-ui-form td.setters .form-item div.form-radios,
+ form#context-ui-form td.getters .form-item div.form-radios {
+ background:#fff; border:1px solid #ace;
+ height:12em; font-size:.9em;
+ overflow:auto;
+ }
+
+ form#context-ui-form td.setters .form-item div.form-checkboxes .form-item,
+ form#context-ui-form td.getters .form-item div.form-checkboxes .form-item,
+ form#context-ui-form td.setters .form-item div.form-radios .form-item,
+ form#context-ui-form td.getters .form-item div.form-radios .form-item {
+ border-bottom:1px solid #e8f0f8; padding:.1em;
+ display:block;
+ }
+
+/* Block visibility controls */
+form#context-ui-form div.context-ui-block-selector,
+form#context-ui-form div.context-ui-block-regions {
+ overflow:hidden;
+}
+
+ form#context-ui-form div.context-ui-block-selector .form-item {
+ margin:0em 0em 1em;
+ }
+
+ form#context-ui-form div.context-ui-block-selector select {
+ width:100%;
+ }
+
+form#context-ui-form div.context-ui-block-regions .item-list {
+ border-left:1px solid #ace; border-right:1px solid #ace;
+ margin:0em 0em .5em;
+}
+
+ form#context-ui-form div.context-ui-block-regions .item-list h3 {
+ background:#ace;
+ padding: .25em; margin:0em;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul,
+ form#context-ui-form div.context-ui-block-regions .item-list ul li {
+ background:transparent; padding:0em; margin:0em;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li {
+ line-height:20px;
+ padding:.25em; background:#e8f0f8;
+ border-bottom:1px solid #ace;
+ border-top: 1px solid #fff;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li.disabled {
+ color:#999;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li div.tools {
+ background:#ace;
+ float:right;
+ height:20px;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li div.tools span {
+ cursor:pointer;
+ float:left; display:block; text-indent:-9999px; overflow:hidden;
+ width:20px; height:20px;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li div.tools span.up {
+ background: url(widgets.gif) 0% 0% no-repeat;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li div.tools span.down {
+ background: url(widgets.gif) 50% 0% no-repeat;
+ }
+
+ form#context-ui-form div.context-ui-block-regions .item-list ul li div.tools span.remove {
+ background: url(widgets.gif) 100% 0% no-repeat;
+ }
diff --git a/context_ui/context_ui.js b/context_ui/context_ui.js
new file mode 100644
index 0000000..49a3dfd
--- /dev/null
+++ b/context_ui/context_ui.js
@@ -0,0 +1,116 @@
+// $Id$
+
+if (typeof(Drupal) == "undefined" || !Drupal.context_ui) {
+ Drupal.context_ui = {};
+}
+
+Drupal.context_ui.attach = function() {
+ var item_tools = "<div class='tools'><span class='up'>Up</span><span class='down'>Down</span><span class='remove'>X</span></div>";
+
+ // multiselect handler
+ $("input#edit-block-selector-add").click(function() {
+ var region = $("select#edit-block-selector-regions").val().replace('_', '-');
+ var selected = $("select#edit-block-selector-blocks option:selected");
+ if (selected.size() > 0) {
+ $("div.context-ui-block-regions ul." + region + " li.dummy").remove();
+ selected.each(function() {
+ if (!$(this).attr('disabled')) {
+ // create new block li
+ var block = document.createElement('li');
+ var value = $(this).attr('value');
+ var text = item_tools + $(this).text();
+ $(block).attr('title', value).html(text);
+
+ // attach tool handlers
+ Drupal.context_ui.attachtools(block);
+
+ // remove option
+ $(this).remove();
+
+ // add block item to region
+ $("div.context-ui-block-regions ul."+ region).append(block);
+
+ Drupal.context_ui.regionblocks(region);
+ }
+ });
+ }
+ });
+
+ // attach tool handler to existing context_ui blocks
+ $("div.context-ui-block-regions ul li").each(function() {
+ Drupal.context_ui.attachtools(this);
+ });
+}
+
+Drupal.context_ui.attachtools = function(block) {
+ if ($("div.tools", block).size() > 0) {
+ // remove block
+ $("div.tools span.remove", block).click(function() {
+ var item = $(this).parents("li");
+ $("div.tools", item).remove();
+
+ // create new block select option
+ var option = document.createElement('option');
+ var value = $(item).attr('title');
+ var text = item.text();
+ $(option).attr('value', value).text(text);
+
+ // retrieve region info before item is deleted
+ var region = $(item).parents("ul").attr("class");
+
+ // remove block item
+ item.remove();
+
+ // add block option
+ $("select#edit-block-selector-blocks").append(option);
+
+ Drupal.context_ui.regionblocks(region);
+ });
+ // move block up
+ $("div.tools span.up", block).click(function() {
+ var prev = $(this).parents("li").prev();
+ if (prev) {
+ var item = $(this).parents("li");
+ var region = $(this).parents("ul").attr("class");
+ prev.before(item);
+ Drupal.context_ui.regionblocks(region);
+ }
+ });
+ // move block down
+ $("div.tools span.down", block).click(function() {
+ var next = $(this).parents("li").next();
+ if (next) {
+ var item = $(this).parents("li");
+ var region = $(this).parents("ul").attr("class");
+ next.after(item);
+ Drupal.context_ui.regionblocks(region);
+ }
+ });
+ }
+}
+
+Drupal.context_ui.regionblocks = function (region) {
+ var serialized = '';
+ if ($("div.context-ui-block-regions ul."+ region +" li").size() > 0) {
+ $("div.context-ui-block-regions ul."+ region +" li").each(function() {
+ if (serialized == '') {
+ serialized = $(this).attr('title');
+ }
+ else {
+ serialized = serialized +","+ $(this).attr('title');
+ }
+ });
+ $("input#edit-block-regions-"+ region).val(serialized);
+ }
+ else if ($("input#edit-block-regions-"+ region).size() > 0) {
+ $("input#edit-block-regions-"+ region).val('');
+ }
+}
+
+if (Drupal.jsEnabled) {
+ $(document).ready(function() {
+ if ($('form#context-ui-form').size() > 0) {
+ Drupal.context_ui.attach();
+ }
+ });
+};