annotate gis_gui/blocks/home.js @ 253:d6c7bedf4370

New reload button active in upper right corner of block
author fknauft
date Fri, 23 Sep 2011 13:11:46 +0200
parents b6aa7b77d110
children 52b1247140b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
63
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
1 $(".block.home").livequery(function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
2
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
3 var homeblock = $(this);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
4
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
5 // OPEN
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
6 homeblock.find(".open_button").live("click", function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
7 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
8 homeblock.find(".open_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
9 homeblock.find('.subscreen.open').fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
10 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
11
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
12 // OPEN TASKS
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
13 homeblock.find(".open_table_button").live("click", function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
14 // homeblock.find(".task[id*=open_]").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
15 homeblock.find(".open_table_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
16 // load list of tables
66
da0556e4fa10 open only user tables
casties
parents: 63
diff changeset
17 homeblock.find(".open_table select").load("../db/RESTdb/db/public/?format=HTML&type=schema_usertables&layout=select&element_id=tables #tables *",
63
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
18 function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
19 $(this).find("option").dblclick(
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
20 function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
21 console.debug("table option dblclick");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
22 console.debug("this=",this);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
23 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
24 foldBlock($(this).parents().filter(".block"));
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
25 var tablename = $(this).val();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
26 blocks.addTableBlock("blocks/table.html?table="+escape(tablename),"table", tablename);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
27 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
28 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
29 homeblock.find(".subscreen.open_table").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
30 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
31
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
32 homeblock.find(".open_layer_button").live("click", function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
33 homeblock.find(".open_layer_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
34 // load list of layers
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
35 var el = homeblock.find(".subscreen.open_layer select").get(0);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
36 blocks.loadListOfItems("test1","layer",function(data) {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
37 console.debug("open layer list of items=",data);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
38 $(el).empty();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
39 for (var i=0; i < data.length; i++) {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
40 var key = data[i].key;
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
41 var val = data[i].val;
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
42 var name = val.name;
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
43 console.debug("layer",i," key=",key," value=",name);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
44 $(el).append('<option value="'+key+'">'+name+'</option>');
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
45 }
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
46 // arm load layer button
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
47 homeblock.find(".open_open_layer").unbind("click");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
48 homeblock.find(".open_open_layer").click(function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
49 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
50 foldBlock($(this).parents().filter(".block"));
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
51 var layername = $(this).parent().find("select").val();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
52 var params = jQuery.grep(data, function(x){return (x.key == layername);})[0].val;
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
53 console.debug("open layer=",layername," params=",params);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
54 var newblock = blocks.addLayerBlock("blocks/layer.html?table="+escape(params.table),"layer", params);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
55 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
56 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
57 homeblock.find(".subscreen.open_layer").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
58 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
59
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
60 homeblock.find(".open_map_button").live("click", function(){
67
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
61 homeblock.find(".open_map_button").addClass("selected");
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
62 // load list of maps
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
63 var el = homeblock.find(".subscreen.open_map select").get(0);
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
64 blocks.loadListOfItems("test1","map",function(data) {
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
65 console.debug("open map list of items=",data);
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
66 $(el).empty();
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
67 for (var i=0; i < data.length; i++) {
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
68 var key = data[i].key;
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
69 var val = data[i].val;
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
70 var name = val.name;
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
71 console.debug("map",i," key=",key," value=",name);
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
72 $(el).append('<option value="'+key+'">'+name+'</option>');
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
73 }
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
74 // arm load map button
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
75 homeblock.find(".open_open_map").unbind("click");
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
76 homeblock.find(".open_open_map").click(function() {
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
77 clearAllTasks();
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
78 foldBlock($(this).parents().filter(".block"));
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
79 var mapname = $(this).parent().find("select").val();
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
80 var params = jQuery.grep(data, function(x){return (x.key == mapname);})[0].val;
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
81 console.debug("open map=",mapname," params=",params);
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
82 var newblock = blocks.addMapBlock("blocks/map.html?table="+escape(params.table),"map", params);
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
83 });
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
84 });
b6aa7b77d110 work on saving and loading maps
casties
parents: 66
diff changeset
85 homeblock.find(".subscreen.open_map").fadeIn();
63
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
86 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
87
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
88 // open subtasks
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
89 homeblock.find(".open_open_view").live('click', function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
90 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
91 foldBlock($(this).parents().filter(".block"));
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
92 addBlock("blocks/view?title=view","view");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
93 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
94 homeblock.find(".open_workspace_button").live('click', function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
95 window.location.href="workspace";
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
96 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
97 // load table button
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
98 homeblock.find(".open_open_table").live("click", function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
99 // switchSubscreens(homeblock, 'open', 'main');
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
100 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
101 foldBlock($(this).parents().filter(".block"));
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
102 var tablename = $(this).parent().find("select").val();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
103 var newblock = blocks.addTableBlock("blocks/table.html?table="+escape(tablename),"table", tablename);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
104 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
105
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
106
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
107 // CREATE
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
108 homeblock.find(".create_button").live('click', function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
109 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
110 homeblock.find(".create_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
111 homeblock.find(".subscreen.create").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
112 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
113 // CREATE TASKS
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
114 // create table menu
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
115 homeblock.find(".create_table_button").live("click", function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
116 // homeblock.find(".task[id*=open_]").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
117 homeblock.find(".create_table_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
118 homeblock.find(".subscreen.create_table").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
119 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
120 homeblock.find(".create_table_empty_button").live("click", function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
121 // homeblock.find(".task[id*=open_]").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
122 clearTasks(".create_table",".create_table_task");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
123 homeblock.find(".create_table_empty_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
124 homeblock.find(".subscreen.create_table_empty").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
125 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
126 homeblock.find(".create_table_file_button").live("click", function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
127 // homeblock.find(".task[id*=open_]").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
128 clearTasks(".create_table",".create_table_task");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
129 homeblock.find(".create_table_file_button").addClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
130 homeblock.find(".subscreen.create_table_file").fadeIn();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
131 var segment = $(this).parents().filter(".block");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
132 var uploadForm = homeblock.find(".create_table_file_form").get();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
133 $(uploadForm).unbind("submit");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
134 $(uploadForm).iframePostForm({
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
135 post: blocks.checkTableSubmitFn(segment),
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
136 complete: blocks.checkTableCompleteFn(segment,uploadForm)
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
137 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
138
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
139 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
140
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
141 homeblock.find(".create_table_empty_create_button").live("click", function() {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
142 // switchSubscreens(homeblock, 'open', 'main');
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
143 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
144 foldBlock($(this).parents().filter(".block"));
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
145 var tablename = $(this).parent().find(".create_table_name").val();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
146 var tablefile = $(this).parent().find(".create_table_file").val();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
147 var newblock = blocks.addTableBlock("blocks/table.html?table="+escape(tablename),"table", tablename);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
148 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
149
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
150 // SEARCH
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
151 homeblock.find(".search_button").live('click', function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
152 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
153 var segment = $(this).parents().filter(".block");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
154 foldBlock(segment);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
155 addBlock("blocks/search?title=search","search");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
156 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
157 // NOTES
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
158 homeblock.find(".notes_button").live('click', function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
159 clearAllTasks();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
160 var segment = $(this).parents().filter(".block");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
161 foldBlock(segment);
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
162 addBlock("blocks/notes?title=notes","notes");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
163 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
164
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
165 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
166
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
167
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
168 function clearAllTasks(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
169 $(".block.home").each(function(){
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
170 $(this).find(".task").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
171 $(this).find(".subscreen:not(.main)").hide();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
172 });
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
173 }
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
174
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
175 function clearTasks(selectClass,taskClass) {
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
176 $(".block.home").find(".subscreen"+selectClass).find(".task").removeClass("selected");
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
177 $(".block.home").find(".subscreen"+taskClass).hide();
7f008e782563 add gui files to product via FileSystemSite
casties
parents:
diff changeset
178 }