Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate
1
<!DOCTYPE HTML>
2
<head>
3
    <meta charset="UTF-8" />
4
    <title>{{_('Welcome to Sugar Network')}}</title>
5
    <link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
6
    <link rel="stylesheet" href="/static/css/browser.css" type="text/css" />
7
    <link rel="stylesheet" href="/static/css/sugar-theme/jquery-ui-1.8.16.sugar.css" />
8
    <script src="/static/js/jquery.tools.min.js"></script>
9
    <script src="/static/js/jquery.history.js"></script>
10
    <script src="/static/js/jquery-ui-1.8.16.sugar.min.js" type="text/javascript"></script>
11
    <script src="/static/js/jquery.livequery.min.js" type="text/javascript" charset="utf-8"></script>
12
    <script src="/static/js/toastr.js"></script>
13
    <link href="/static/css/toastr.css" rel="stylesheet"/>
14
    <!--script src="/static/js/sticky.full.js" type="text/javascript"></script-->
15
    <!--link rel="stylesheet" href="/static/css/sticky.full.css" type="text/css" /-->
16
    <style>
17
        .sugar-network-online {
18
            background-color: {{fill}};
19
            border: 4px solid {{stroke}};
20
            border-radius: 15px;
21
            -moz-border-radius: 15px;
22
            -webkit-border-radius: 15px;
23
            padding: 2px;
24
            }
25
        .ui-autocomplete-loading {
26
            background: white url('/static/images/throbber5.gif') right center no-repeat;
27
            }
28
        .grid-icon:hover {
29
            color: white;
30
            padding: 28px;
31
            background-color: {{fill}};
32
            border: 4px solid {{stroke}};
33
            border-radius: 15px;
34
            -moz-border-radius: 15px;
35
            -webkit-border-radius: 15px;
36
            z-index: 50;
37
            }
38
        @media (max-width:801px) {
39
            body {}
40
            .grid-icon:hover {
41
                padding: 20px;
42
            }
43
            }
44
    </style>
45
</head>
46
<body>
47
    {% include 'toolbar.html' %}
48
    <div id="content">
49
    {% block view %}{% endblock view %}
50
    </div>
51
    <div id='bottom-palette'>
52
        {%- block bottom_palette %}
53
        <div id='nav-buttons'>
54
            <a class="prev browse up"></a>
55
            <a class="next browse down"></a>
56
        </div>
57
        {%- endblock bottom_palette %}
58
        <span id="info">{{info}}</span>
59
    </div>
60
    <!--div id="edit-form" class="dialog">
61
            <div class="window-buttons top-out">
62
                <img id="accept-button" class="button window-button" src="/static/icons/dialog-ok.png" />
63
                <img id="cancel-button" class="button window-button" src="/static/icons/dialog-cancel.png" />
64
            </div>
65
        <form method="POST" action="/submit_edit">
66
            <input name="resource-type" type="hidden" value="" />
67
            <input name="guid" type="hidden" value="" />
68
            <input id="edit-title" name="title" class="resource-input" type="text" value="" />
69
            <textarea id="edit-description" class="resource-input" name="description"></textarea>
70
        </form>
71
    </div-->
72
    <div class="dialog" id="mejorar-sistema-form">
73
        <div id="resource-card-title">
74
            <span id="dialog-title">{{_('New resource')}} : {{session.get('last_context_title') or _('Sugar Network')}}</span>
75
            <div class="window-buttons">
76
                <img id="cancel-button" class="button window-button" src="/static/icons/dialog-cancel.png" />
77
                {#%- if (session['connected'] or False) -%#}
78
                <img id="accept-button" class="button window-button" src="/static/icons/dialog-ok.png" />
79
                {#%- endif -%#}
80
            </div>
81
        </div>
82
        {#%- if (session['connected'] or False) -%#}
83
        <form id="resource-form1" method="POST" action="/submit_resource">
84
        <div class="resource-form-field">
85
            <span id="title_label">{{_('Title')}}</span><br/>
86
            <input name="guid" type="hidden" value="{{session['last_context']}}" />
87
            <input onkeypress="return event.keyCode != 13;" name="title" id="title" class="resource-input" type="text"/>
88
            <input id="resource_type" name="resource_type" type="hidden" value="" />
89
            <input id="href" name="href" type="hidden" value="" />
90
            <input id="edit_guid" name="edit_guid" type="hidden" value="" />
91
        </div>
92
        <div class="resource-form-field" id="summary_section">
93
            <span id="summary_label">{{_('Summary')}}</span><br/>
94
            <input onkeypress="return event.keyCode != 13;" id="summary" name="summary" class="resource-input" type="text"/>
95
        </div>
96
        <div class="resource-form-field">
97
            <span id="details_label">{{_('Details')}}</span><br/>
98
            <textarea id="edit-content" name="content" class="resource-inputarea" ></textarea>
99
        </div>
100
        </form>
101
        <div id="submit-buttons">
102
            <img class="question-button button has_tooltip" src="/static/icons/emblem-question.png" title="{{_('submit question')}}" />
103
            <br />
104
            <img class="idea-button button has_tooltip" src="/static/icons/emblem-charging.png" title="{{_('submit idea')}}" />
105
            <br />
106
            <img class="problem-button button has_tooltip" src="/static/icons/emblem-notification.png" title="{{_('submit problem')}}" />
107
        </div>
108
        {#%- else -%}
109
        <div class="resource-form-field">
110
            <br/>
111
            <br/>
112
            <b>{{_('Alpha Version')}}</b>
113
            <br/>
114
            {{_('For the time being you need to be connected to the Internet in order to contribute!')}}
115
        </div>
116
        {%- endif -%#}
117
    </div>
118
    <script type="text/javascript">
119
    {%- block script %}
120
        var oldh;
121
        var oldw;
122
123
        (function(window,undefined){
124
            // Prepare History.js
125
            var History = window.History; // Note: We are using a capital H instead of a lower h
126
            if ( !History.enabled ) {
127
                 // History.js is disabled for this browser.
128
                 // This is because we can optionally choose to support HTML4 browsers or not.
129
                return false;
130
            }
131
        })(window);
132
133
        function edit_context(guid, title, summary, description) {
134
            dialog = $('#mejorar-sistema-form');
135
            oldh = dialog.css('height');
136
            oldw = dialog.css('width');
137
            dialog.css('height', '450px');
138
            dialog.css('width', '700px');
139
            $('#summary_section').css('height', '73px');
140
            $('#summary_section').css('padding', '7px 20px');
141
            $('input#summary').val(summary);
142
            $('input#title').val(title);
143
            $('textarea#edit-content').val(description);
144
            $('#dialog-title').empty().append('{{_("Edit project")}}');
145
            $('#title_label').empty().append('{{_("Name")}}');
146
            $('#details_label').empty().append('{{_("Article")}}');
147
            $('textarea.resource-inputarea').css('height', '170px');
148
            dialog.expose({
149
                closeOnClick: false,
150
                onBeforeClose: function(event) {
151
                    dialog.fadeOut(
152
                        function () {
153
                            dialog.css('height', oldh);
154
                            dialog.css('width', oldw);
155
                            $('#title_label').empty().append('{{_("Title")}}');
156
                            $('#details_label').empty().append('{{_("Details")}}');
157
                            $('#summary_section').css('height', '0px');
158
                            $('#summary_section').css('padding', '0px 0px');
159
                            $('textarea.resource-inputarea').css('height', '100px');
160
                            $('input#title').val('');
161
                            $('input#summary').val('');
162
                            $('textarea#edit-content').val('');
163
                        }
164
                    );
165
                    }
166
                });
167
            dialog.fadeIn();
168
            $('input#title').val(title);
169
            $('input#resource_type').val(resource_type);
170
            $('input#edit_guid').val(guid);
171
            $('input#href').val(location.href);
172
            $('input#title').focus();
173
174
            $('#submit-buttons').hide();
175
            $('#accept-button').show();
176
            if (title==false) {
177
                $('input.resource-input').parent().hide();
178
                $('#details_label').hide();
179
                $('input.resource-input').val('');
180
                }
181
            else {
182
                $('#details_label').show();
183
                $('input.resource-input').parent().show();
184
                }
185
            $('#accept-button').click( function () {
186
                $("#resource-form1").attr('action', '/update_context');
187
                $("#resource-form1").submit();
188
                $('#mejorar-sistema-form').fadeOut();
189
                });
190
191
            $('#cancel-button').click( function () {
192
                $('#mejorar-sistema-form').fadeOut();
193
                $.mask.close();
194
                });
195
            }
196
197
        function new_context(resource_type, guid, content, title) {
198
            dialog = $('#mejorar-sistema-form');
199
            oldh = dialog.css('height');
200
            oldw = dialog.css('width');
201
            dialog.css('height', '450px');
202
            dialog.css('width', '700px');
203
            $('#summary_section').css('height', '73px');
204
            $('#summary_section').css('padding', '7px 20px');
205
            $('#dialog-title').empty().append('{{_("Create new project")}}');
206
            $('#title_label').empty().append('{{_("Name")}}');
207
            $('#details_label').empty().append('{{_("Article")}}');
208
            $('textarea.resource-inputarea').css('height', '170px');
209
            dialog.expose({
210
                closeOnClick: false,
211
                onBeforeClose: function(event) {
212
                    dialog.fadeOut(
213
                        function () {
214
                            dialog.css('height', oldh);
215
                            dialog.css('width', oldw);
216
                            $('#title_label').empty().append('{{_("Title")}}');
217
                            $('#details_label').empty().append('{{_("Details")}}');
218
                            $('#summary_section').css('height', '0px');
219
                            $('#summary_section').css('padding', '0px 0px');
220
                            $('textarea.resource-inputarea').css('height', '100px');
221
                            $('input#title').val('');
222
                            $('input#summary').val('');
223
                            $('textarea#edit-content').val('');
224
                        }
225
                    );
226
                    }
227
                });
228
            dialog.fadeIn();
229
            $('input#title').val(title);
230
            $('input#resource_type').val(resource_type);
231
            $('input#edit_guid').val(guid);
232
            $('input#href').val(location.href);
233
            $('input#title').focus();
234
            $('textarea.edit-content').val(content);
235
236
            $('#submit-buttons').hide();
237
            $('#accept-button').show();
238
            if (title==false) {
239
                $('input.resource-input').parent().hide();
240
                $('#details_label').hide();
241
                $('input#title').val('');
242
                }
243
            else {
244
                $('#details_label').show();
245
                $('input.resource-input').parent().show();
246
                }
247
            $('#accept-button').click( function () {
248
                $("#resource-form1").attr('action', '/submit_context');
249
                $("#resource-form1").submit();
250
                $('#mejorar-sistema-form').fadeOut();
251
                });
252
253
            $('#cancel-button').click( function () {
254
                $('#mejorar-sistema-form').fadeOut();
255
                $.mask.close();
256
                });
257
            }
258
259
        function edit_resource(resource_type, guid, content, title) {
260
            dialog = $('#mejorar-sistema-form');
261
            $('#dialog-title').empty().append('{{_("Edit resource")}}');
262
            dialog.expose({
263
                closeOnClick: false,
264
                onBeforeClose: function(event) {
265
                    dialog.fadeOut();
266
                    }
267
                });
268
            dialog.fadeIn();
269
            $('input#title').val(title);
270
            $('input#resource_type').val(resource_type);
271
            $('input#edit_guid').val(guid);
272
            $('input#href').val(location.href);
273
            $('input#title').focus();
274
            $('textarea.resource-inputarea').val(content);
275
276
            $('#submit-buttons').hide();
277
            $('#accept-button').show();
278
            if (title==false) {
279
                $('input.resource-input').parent().hide();
280
                $('#details_label').hide();
281
                $('input#title').val('');
282
                }
283
            else {
284
                $('#details_label').show();
285
                $('input.resource-input').parent().show();
286
                }
287
            $('#accept-button').click( function () {
288
                $("#resource-form1").attr('action', '/submit_edit');
289
                $("#resource-form1").submit();
290
                $('#mejorar-sistema-form').fadeOut();
291
                });
292
293
            $('#cancel-button').click( function () {
294
                $('#mejorar-sistema-form').fadeOut();
295
                $.mask.close();
296
                });
297
            }
298
299
        var _selected = false;
300
        var _query = false;
301
        function init_styles(inactive_color) {
302
            if (inactive_color == null){
303
               inactive_color = '#c9c9c9';
304
                }
305
            /* $('.star-emblem').hover( function() {
306
                $(this).css('background-color','{{fill}}');
307
                $(this).css('border','1px solid {{stroke}}');
308
            }, function() {
309
                $(this).css('background-color', '#fff');
310
                $(this).css('border','1px solid #fff');
311
                });
312
            $('.moon-emblem').hover( function() {
313
                $(this).css('background-color','{{fill}}');
314
                $(this).css('border','1px solid {{stroke}}');
315
            }, function() {
316
                $(this).css('background-color', '#fff');
317
                $(this).css('border','1px solid #fff');
318
                }); */
319
            $('.box-button').css('visibility', 'hidden');
320
            $('.grid-item').hover( function() {
321
                $(".box-button", this).css('visibility', 'visible');
322
                }, function() {
323
                $(".box-button", this).css('visibility', 'hidden');
324
                });
325
            $('.question-icon').css('background-color', "#D7EBF2");
326
            $('.question-icon').hover( function() {
327
                    $(this).css('background-color', '#3b4ad7');
328
                }, function() {
329
                    $(this).css('background-color', "#D7EBF2");
330
                });
331
            $('.idea-icon').css('background-color', "#D7EBF2");
332
            $('.idea-icon').hover( function() {
333
                    $(this).css('background-color', '#fcef30');
334
                }, function() {
335
                    $(this).css('background-color', "#D7EBF2");
336
                });
337
            $('.problem-icon').css('background-color', "#D7EBF2");
338
            $('.problem-icon').hover( function() {
339
                    $(this).css('background-color', '#e53490');
340
                }, function() {
341
                    $(this).css('background-color', "#D7EBF2");
342
                });
343
            $('.review-icon').css('background-color', "#D7EBF2");
344
            $('.review-icon').hover( function() {
345
                    $(this).css('background-color', '#98C40C');
346
                }, function() {
347
                    $(this).css('background-color', "#D7EBF2");
348
                });
349
            $('.gallery-icon').css('background-color', "#D7EBF2");
350
            $('.gallery-icon').hover( function() {
351
                    $(this).css('background-color', '#98C40C');
352
                }, function() {
353
                    $(this).css('background-color', "#D7EBF2");
354
                });
355
            $('.wiki-icon').css('background-color', "#D7EBF2");
356
            $('.wiki-icon').hover( function() {
357
                    $(this).css('background-color', '#98C40C');
358
                }, function() {
359
                    $(this).css('background-color', "#D7EBF2");
360
                });
361
            // Make sure selected resource is highlighted
362
            resource='.{{resource_type}}';
363
            $(resource+'-icon').css('background-color', "#9ccec9");
364
            $(resource+'-icon').unbind('mouseenter mouseleave');
365
            $('.button_selected').css('background-color', "#9CCEC9");
366
            $('.button_selected').unbind('mouseenter mouseleave');
367
            //
368
            $('.star-emblem').click( function() {
369
                if ( $(this).data('favorite') == true) {
370
                    $(this).css('background-color', '#fff');
371
                    $(this).css('border','1px solid #fff');
372
                    $(this).data('favorite', false);
373
                    }
374
                else {
375
                    $(this).css('background-color','{{fill}}');
376
                    $(this).css('border','1px solid {{stroke}}');
377
                    $(this).data('favorite', true);
378
                    }
379
                $.get('/_stars/' + $(this).attr("id") + '?favorite=' +
380
                    $(this).data('favorite'),
381
                    function (data) {/* alert (data.favorite) */} );
382
                });
383
            $('.moon-emblem').click( function() {
384
                if ( $(this).data('clone') == true) {
385
                    $(this).css('background-color', '#fff');
386
                    $(this).css('border','1px solid #fff');
387
                    $(this).data('clone', false);
388
                    }
389
                else {
390
                    $(this).css('background-color','{{fill}}');
391
                    $(this).css('border','1px solid {{stroke}}');
392
                    $(this).data('clone', true);
393
                    }
394
                $.get('/_moon/' + $(this).attr("id") + '?clone=' +
395
                    $(this).data('clone'),
396
                    function (data) {/* alert (data.favorite) */} );
397
                });
398
        };
399
400
   $(document).ready( function() {
401
        sse = new EventSource('/my_event_source');
402
        /*
403
        sse.onmessage = function(message) {
404
            data = $.parseJSON(message.data);
405
            if (data.event=="inline" && data.state=="offline") {
406
                toastr.info('{{_('You are in offline mode')}}');
407
                $('#sn-button-img').removeClass('sugar-network-online');
408
                // location.reload();
409
                // TODO: proper ajaxy reload
410
                }
411
            if (data.event=="inline" && data.state=="online") {
412
                toastr.info('{{_('You are in online mode')}}');
413
                $('#sn-button-img').addClass('sugar-network-online');
414
                // location.reload();
415
                // TODO: proper ajaxy reload
416
                }
417
            // TODO: Handle these
418
            if (data.event=="push") {
419
                toastr.info('Sugar Network is synchronized.');
420
                }
421
            if (data.event=="create") {
422
                toastr.warning('New ' + data.props.type[0]);
423
                }
424
            console.log('A message has arrived!');
425
        }
426
        */
427
428
        $( "#sn-button" ).tooltip({position:"bottom right", offset:[-3,-60], predelay:500});
429
        $( "#browser-button" ).tooltip({position:"bottom right", offset:[-3,-60], predelay:500});
430
        $( ".has_tooltip" ).livequery( function () {
431
432
            $( this ).tooltip({position:"bottom right", tipClass:"generic_tooltip"
433
/*                onShow: function(event, position) {
434
                    var tip = this.getTip();
435
                    var new_pos = $(window).width() - (parseInt( tip.css( 'width' ), 10) + 110);
436
                    tip.css( 'position', "fixed" );
437
                    tip.css( 'top', "4px" );
438
                    tip.css( 'left', new_pos + "px" );
439
440
                }
441
                */
442
            })
443
            });
444
445
        $( ".has_tooltip_left" ).livequery( function () {
446
447
            $( this ).tooltip({position:"bottom left", tipClass:"generic_tooltip"})
448
449
            });
450
451
        /*$( "#list-button" ).tooltip({position:"bottom right", offset:[-3,-60], predelay:500});*/
452
        $( "#query" ).autocomplete({
453
            source: "/query",
454
            dataType: "json",
455
            minLength: 2,
456
            change: function( ev ) {
457
                var term = $('#query').val();
458
                _query = term;
459
                if(ev.keyCode == 13) {
460
                    location='/context/search/'+term;
461
                    }
462
                },
463
            select: function( ev, ui ) {
464
                var e = ev || event;
465
                _selected = true;
466
                var term = $('#query').val();
467
                location='/context/reviews/'+ui.item.value;
468
                return false;
469
                },
470
            focus: function (ev, ui) {
471
                return false;
472
                },
473
            search: function (ev, ui) {
474
                var term = $('#query').val();
475
                if (term.indexOf(' ')!=-1) {
476
                    $('#query').autocomplete('close');
477
                    return false;
478
                    }
479
                }
480
            }
481
        );
482
        $( "#query" ).keyup(onKeyPressed);
483
    });
484
485
    function onKeyPressed(ev) {
486
        var e = ev || event;
487
        var term = $('#query').val();
488
        if(e.keyCode == 13 && _selected==false) {
489
            location='/context/search/'+term;
490
            return false; //prevents form from being submitted.
491
        }
492
    }
493
    {%- endblock script %}
494
    </script>
495
</body>
496
</html>