Commit 002f96cc57e569b1388e002e80e9ac5c916f93a2

Authored by Bartłomiej Nitoń
1 parent f4aa246d

Added entry view.

dictionary/views.py
... ... @@ -245,6 +245,248 @@ def lemma_view(request):
245 245 js_vars[var] = request.session[var]
246 246  
247 247 return {'js_vars': js_vars}
  248 +
  249 +
  250 +from dictionary.models import Lemma, get_ready_statuses
  251 +from common.decorators import render, ajax
  252 +
  253 +@render('entry.html')
  254 +@ajax(method='get', encode_result=False)
  255 +def entry(request, lemma, pos):
  256 + error = ''
  257 + lemma_id = -1
  258 + try: # status jeszcze tutaj wykorzystac
  259 + lemma_obj = Lemma.objects.get(entry_obj__name=lemma, entry_obj__pos__tag=pos,
  260 + old=False, status__in=get_ready_statuses())
  261 + lemma_id = lemma_obj.id
  262 + except Lemma.DoesNotExist:
  263 + error = 'Hasło nie istnieje w Walentym.'
  264 +
  265 + if not request.session.has_key('lemma_from_note_entry'):
  266 + request.session['lemma_from_note_entry'] = ''
  267 + if not request.session.has_key('lemma_from_note_id'):
  268 + request.session['lemma_from_note_id'] = ''
  269 +
  270 + # sorting rules
  271 + if not request.session.has_key('sort_rules'):
  272 + request.session['sort_rules'] = default_sort_rules()
  273 + else:
  274 + if not 'id' in request.session['sort_rules']:
  275 + request.session['sort_rules']['id'] = {'priority': None, 'sort_order': 'desc'}
  276 + if not 'entry' in request.session['sort_rules']:
  277 + request.session['sort_rules']['entry'] = {'priority': None, 'sort_order': 'desc'}
  278 + if not 'owner' in request.session['sort_rules']:
  279 + request.session['sort_rules']['owner'] = {'priority': None, 'sort_order': 'desc'}
  280 + if not 'phraseologist' in request.session['sort_rules']:
  281 + request.session['sort_rules']['phraseologist'] = {'priority': None, 'sort_order': 'desc'}
  282 + if not 'semanticist' in request.session['sort_rules']:
  283 + request.session['sort_rules']['semanticist'] = {'priority': None, 'sort_order': 'desc'}
  284 + if not 'vocabulary' in request.session['sort_rules']:
  285 + request.session['sort_rules']['vocabulary'] = {'priority': None, 'sort_order': 'desc'}
  286 + if not 'status' in request.session['sort_rules']:
  287 + request.session['sort_rules']['status'] = {'priority': None, 'sort_order': 'desc'}
  288 +
  289 + if not request.session.has_key('sort_rules_lemma_preview'):
  290 + request.session['sort_rules_lemma_preview'] = default_sort_rules()
  291 + else:
  292 + if not 'id' in request.session['sort_rules_lemma_preview']:
  293 + request.session['sort_rules_lemma_preview']['id'] = {'priority': None, 'sort_order': 'desc'}
  294 + if not 'entry' in request.session['sort_rules_lemma_preview']:
  295 + request.session['sort_rules_lemma_preview']['entry'] = {'priority': None, 'sort_order': 'desc'}
  296 + if not 'owner' in request.session['sort_rules_lemma_preview']:
  297 + request.session['sort_rules_lemma_preview']['owner'] = {'priority': None, 'sort_order': 'desc'}
  298 + if not 'phraseologist' in request.session['sort_rules_lemma_preview']:
  299 + request.session['sort_rules_lemma_preview']['phraseologist'] = {'priority': None, 'sort_order': 'desc'}
  300 + if not 'semanticist' in request.session['sort_rules_lemma_preview']:
  301 + request.session['sort_rules_lemma_preview']['semanticist'] = {'priority': None, 'sort_order': 'desc'}
  302 + if not 'vocabulary' in request.session['sort_rules_lemma_preview']:
  303 + request.session['sort_rules_lemma_preview']['vocabulary'] = {'priority': None, 'sort_order': 'desc'}
  304 + if not 'status' in request.session['sort_rules_lemma_preview']:
  305 + request.session['sort_rules_lemma_preview']['status'] = {'priority': None, 'sort_order': 'desc'}
  306 +
  307 + if (not request.session.has_key('filter_rules') or
  308 + not all_filter_rules_loaded(request.session['filter_rules'])):
  309 + request.session['filter_rules'] = default_filter_rules()
  310 +
  311 + if (not request.session.has_key('filter_rules_lemma_preview') or
  312 + not all_filter_rules_loaded(request.session['filter_rules_lemma_preview'])):
  313 + request.session['filter_rules_lemma_preview'] = default_filter_rules()
  314 +
  315 + if not request.session.has_key('lemma_preview'):
  316 + request.session['lemma_preview'] = False
  317 +
  318 + if not request.session.has_key('similar_lemmas'):
  319 + request.session['similar_lemmas'] = ''
  320 +
  321 + ordered_sort_rules = order_sort_rules(request.session['sort_rules'])
  322 + pos_cat_vals_objs = PositionCategory.objects.order_by('priority')
  323 + pos_cat_vals_tab = []
  324 + for pos_cat_val_obj in pos_cat_vals_objs:
  325 + pos_cat_vals_tab.append(pos_cat_val_obj.category)
  326 +
  327 + nkjp_opinion_vals_tab = []
  328 + nkjp_opinion_objs = NKJP_Opinion.objects.order_by('priority')
  329 + for opinion in nkjp_opinion_objs:
  330 + nkjp_opinion_vals_tab.append(opinion.opinion)
  331 +
  332 + nkjp_source_vals_tab = []
  333 + nkjp_source_objs = NKJP_Source.objects.order_by('priority')
  334 + for source in nkjp_source_objs:
  335 + nkjp_source_vals_tab.append(source.source)
  336 +
  337 + main_sort_field = ordered_sort_rules[0]['name']
  338 + main_sort_order = ordered_sort_rules[0]['rules']['sort_order']
  339 +
  340 + if request.user.is_authenticated():
  341 + auto_search = UserSettings.objects.get(user=request.user).incremental_search
  342 + else:
  343 + auto_search = False
  344 +
  345 + js_vars = {
  346 + 'ajax_get_page': reverse('get_lemmas'),
  347 + 'ajax_old_frames': reverse('get_old_frames'),
  348 + 'ajax_new_frames': reverse('get_new_frames'),
  349 + 'ajax_change_ctrl': reverse('get_change_ctrl'),
  350 + 'ajax_lemma_examples': reverse('get_lemma_examples'),
  351 + 'ajax_lemma_status': reverse('get_lemma_status'),
  352 + 'ajax_lemma_notes': reverse('get_lemma_notes'),
  353 + 'ajax_lemma_preview': reverse('get_lemma_preview'),
  354 + 'ajax_get_frame_filter_options': reverse('get_frame_filter_options'),
  355 + 'ajax_get_lemma_desc': reverse('get_lemma_desc'),
  356 + 'ajax_get_actual_lemma_id': reverse('get_actual_lemma_id'),
  357 + 'ajax_user_is_authenticated': reverse('user_is_authenticated'),
  358 +
  359 + 'ajax_semantics': reverse('semantics.views.ajax_semantics'),
  360 +
  361 + 'ajax_get_note_text': reverse('get_note_text'),
  362 + 'ajax_lemma_notes_form_submit': reverse('lemma_notes_form_submit'),
  363 + 'ajax_status_need_validation': reverse('status_need_validation'),
  364 + 'ajax_lemma_status_change': reverse('lemma_status_change'),
  365 + 'ajax_send_miss_frames_msg': reverse('send_miss_frames_msg'),
  366 + 'ajax_position_form': reverse('position_form'),
  367 +
  368 + 'ajax_position_lookup': reverse('position_lookup'),
  369 + 'ajax_argument_lookup': reverse('argument_lookup'),
  370 + 'ajax_argument_form': reverse('argument_form'),
  371 + 'ajax_argument_form_submit': reverse('argument_form_submit'),
  372 + 'ajax_add_position': reverse('add_position'),
  373 + 'ajax_create_position_form': reverse('create_position_form'),
  374 + 'ajax_create_position_form_submit': reverse('create_position_form_submit'),
  375 + 'ajax_save_new_frames': reverse('save_new_frames'),
  376 + 'ajax_get_ctrl_preview': reverse('get_ctrl_preview'),
  377 + 'ajax_restore_lemma': reverse('restore_lemma'),
  378 + 'ajax_frame_form': reverse('frame_form'),
  379 + 'ajax_aspect_rel_missing_frames': reverse('aspect_rel_missing_frames'),
  380 + 'ajax_add_new_frames': reverse('add_new_frames'),
  381 + 'ajax_show_skladnica_examples': reverse('show_skladnica_examples'),
  382 + 'ajax_show_frame_realizations': reverse('show_frame_realizations'),
  383 + 'ajax_frame_form_submit': reverse('frame_form_submit'),
  384 + 'ajax_pos_cat_form': reverse('pos_cat_form'),
  385 + 'ajax_can_add_position_category': reverse('can_add_position_category'),
  386 + 'ajax_pos_cat_form_submit': reverse('pos_cat_form_submit'),
  387 + 'ajax_skladnica_example_propositions': reverse('skladnica_example_propositions'),
  388 + 'ajax_xcp_example_propositions': reverse('xcp_example_propositions'),
  389 + 'ajax_nkjp_example_form_submit': reverse('nkjp_example_form_submit'),
  390 + 'ajax_semantic_example_form_submit': reverse('semantic_example_form_submit'),
  391 + 'ajax_remove_example_from_lemma': reverse('remove_example_from_lemma'),
  392 + 'ajax_get_skladnica_example': reverse('get_skladnica_example'),
  393 + 'ajax_get_xcp_example': reverse('get_xcp_example'),
  394 + 'ajax_get_frame_chars': reverse('get_frame_chars'),
  395 + 'ajax_example_opinion_form': reverse('example_opinion_form'),
  396 + 'ajax_example_opinion_form_submit': reverse('example_opinion_form_submit'),
  397 + 'ajax_can_confirm_example': reverse('can_confirm_example'),
  398 + 'ajax_confirm_nkjp_example': reverse('confirm_nkjp_example'),
  399 + 'ajax_location': reverse('get_location'),
  400 + 'ajax_note_session_get': reverse('note_session_get'),
  401 + 'ajax_note_session_clear': reverse('note_session_clear'),
  402 + 'ajax_remove_lemma_note': reverse('remove_lemma_note'),
  403 + 'ajax_lemma_note_form': reverse('lemma_note_form'),
  404 + 'ajax_get_lemma_note': reverse('get_lemma_note'),
  405 + 'ajax_lemma_notes_modify': reverse('lemma_notes_modify'),
  406 + 'ajax_frame_conversion_form': reverse('frame_conversion_form'),
  407 + 'ajax_frame_conversion_form_submit': reverse('frame_conversion_form_submit'),
  408 + 'ajax_need_conversion': reverse('need_conversion'),
  409 + 'ajax_get_compatible_schema_chars': reverse('get_compatible_schema_chars'),
  410 +
  411 + 'ajax_deselect_preview_tab': reverse('deselect_preview_tab'),
  412 + 'ajax_get_schemata': reverse('get_schemata'),
  413 + 'ajax_get_examples': reverse('get_examples'),
  414 + 'ajax_get_schemata_and_examples': reverse('get_schemata_and_examples'),
  415 +
  416 + # powiazywanie hasel (nieczasownikowe)
  417 + 'ajax_relate_entries': reverse('relate_entries'),
  418 + 'ajax_disrelate_entries': reverse('disrelate_entries'),
  419 + 'ajax_are_new_preview_entries_related': reverse('are_new_preview_entries_related'),
  420 +
  421 + # filtry, sortowania, ukrywanie elementow tabeli
  422 + 'ajax_sort_form': reverse('sort_form'),
  423 + 'ajax_filter_form': reverse('filter_form'),
  424 + 'ajax_sort_form_submit': reverse('sort_form_submit'),
  425 + 'ajax_filter_form_submit': reverse('filter_form_submit'),
  426 + 'ajax_sort_column': reverse('sort_column'),
  427 + 'ajax_save_columns': reverse('save_columns'),
  428 + 'ajax_save_columns': reverse('save_columns'),
  429 + 'ajax_get_sort_order': reverse('get_sort_order'),
  430 + 'ajax_sem_arg_form': reverse('sem_arg_form'),
  431 + 'ajax_general_preference_form': reverse('general_preference_form'),
  432 + 'ajax_synset_preference_form': reverse('synset_preference_form'),
  433 + 'ajax_relational_preference_form': reverse('relational_preference_form'),
  434 + 'ajax_synset_context_lookup': reverse('synset_context_lookup'),
  435 +
  436 + # czasowniki podobne
  437 + 'ajax_similar_lemmas_old_form_submit': reverse('similar_lemmas_old_form_submit'),
  438 + 'ajax_similar_lemmas_new_form_submit': reverse('similar_lemmas_new_form_submit'),
  439 + 'ajax_similar_lemmas_show_synonyms': reverse('similar_lemmas_show_synonyms'),
  440 + 'ajax_related_lemmas_show': reverse('related_lemmas_show'),
  441 + 'ajax_similar_lemmas_reset': reverse('similar_lemmas_reset'),
  442 + 'ajax_preview_select': reverse('preview_select'),
  443 +
  444 + # walidacja
  445 + 'ajax_validate_new_frames': reverse('validate_new_frames'),
  446 + 'ajax_validate_semantics': reverse('validate_semantics'),
  447 +
  448 + # modyfikacja przykladow nkjp
  449 + 'ajax_get_nkjp_dict_ids': reverse('get_nkjp_dict_ids'),
  450 +
  451 + # pokazywanie realizacji
  452 + 'ajax_show_realizations': reverse('show_realizations'),
  453 +
  454 + # uprawnienia
  455 + 'ajax_user_has_perm': reverse('user_has_perm'),
  456 +
  457 + # frazeologia
  458 + # 'ajax_has_lexicalized_args': reverse('has_lexicalized_args'),
  459 + 'ajax_phraseologic_propositions_exists': reverse('phraseologic_propositions_exists'),
  460 + 'ajax_arg_can_be_lexicalized': reverse('arg_can_be_lexicalized'),
  461 + 'ajax_assign_phraseologic_frame_form': reverse('assign_phraseologic_frame_form'),
  462 + 'ajax_assign_phraseologic_frame': reverse('assign_phraseologic_frame'),
  463 + 'ajax_entry_lookup': reverse('entry_lookup'),
  464 +
  465 + # inne
  466 + 'ajax_get_arg_id': reverse('get_arg_id'),
  467 +
  468 + # zmienne
  469 + 'ax_main_field': main_sort_field,
  470 + 'ax_sort_order': main_sort_order,
  471 + 'ax_pos_cat_vals': pos_cat_vals_tab,
  472 + 'ax_nkjp_opinion_vals': nkjp_opinion_vals_tab,
  473 + 'ax_nkjp_source_vals': nkjp_source_vals_tab,
  474 + 'ax_auto_search': auto_search,
  475 +
  476 + 'ax_initialColNames': get_grid_col_names(request.user),
  477 + 'ax_initialColModel': get_grid_col_models(request.user)
  478 + }
  479 + show_cols_variables = ('colModel', 'colNames', 'remap')
  480 + for var in show_cols_variables:
  481 + if var in request.session:
  482 + js_vars[var] = request.session[var]
  483 +
  484 + js_vars['lemma'] = lemma_id
  485 + js_vars['error'] = error
  486 +
  487 + return {'js_vars': js_vars}
  488 +
  489 +
248 490  
249 491 def get_grid_col_names(user):
250 492 if user.is_authenticated():
... ...
semantics/static/js/semantics_splitters.js 0 → 100644
  1 +/////////////////////////// Splitters ///////////////////////////
  2 +
  3 +var hSplitterId = 'semantics-hsplit';
  4 +var topSplitId = 'semantics-hsplit-top';
  5 +var bottomSplitId = 'semantics-hsplit-bottom';
  6 +var topVSplitterId = 'semantics-vsplit-top';
  7 +var bottomVSplitterId = 'semantics-vsplit-bottom';
  8 +var topLeftSplitId = 'frames';
  9 +var topRightSplitId = 'schemas';
  10 +var bottomLeftSplitId = 'control';
  11 +var bottomRightSplitId = 'semantics-examples';
  12 +
  13 +function createHSplitter() {
  14 + $('#'+hSplitterId).height($('#right').height() - 70);
  15 +
  16 + if ($.fn.splitter) {
  17 +
  18 + $(window).resize(function() {
  19 + $('#'+hSplitterId).height($('#right').height() - 70);
  20 + });
  21 +
  22 + $('#'+hSplitterId).bind('resize', function(e) {
  23 + var resizeEvt;
  24 + clearTimeout(resizeEvt);
  25 + resizeEvt = setTimeout(function() {
  26 + $('#'+topVSplitterId).trigger('resize', $('#'+topLeftSplitId).width());
  27 + $('#'+bottomVSplitterId).trigger('resize', $('#'+bottomLeftSplitId).width()+7);
  28 + }, 50);
  29 + e.stopPropagation();
  30 + });
  31 +
  32 + $('#'+topSplitId).bind('resize', function(e) {
  33 + $('#'+topVSplitterId).height($('#'+topSplitId).height());
  34 + $('#'+topVSplitterId).children().each(function () {
  35 + $(this).height($('#'+topSplitId).height() - 7);
  36 + });
  37 +
  38 + $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
  39 + $('#'+bottomVSplitterId).children().each(function () {
  40 + $(this).height($('#'+bottomSplitId).height() - 7);
  41 + });
  42 + e.stopPropagation();
  43 + });
  44 + $('#'+bottomSplitId).bind('resize', function(e) {
  45 + e.stopPropagation();
  46 + });
  47 + $('#'+hSplitterId).splitter({
  48 + type: "h",
  49 + minTop: 200,
  50 + minBottom: 100,
  51 + sizeBottom: 170,
  52 + resizeToWidth: true,
  53 + outline: true
  54 + });
  55 + }
  56 +}
  57 +
  58 +function createVTopSplitter() {
  59 + var w=$('#'+topVSplitterId).width();
  60 +
  61 + $('#'+topVSplitterId).height(2*$('#right').height()/3);
  62 +
  63 + if ($.fn.splitter) {
  64 + $('#'+topLeftSplitId).bind('resize', function(e) {
  65 + $('#'+topVSplitterId).height($('#'+topSplitId).height());
  66 + $('#'+topVSplitterId).children().each(function () {
  67 + $(this).height($('#'+topSplitId).height() - 7);
  68 + });
  69 + $('#'+topRightSplitId).width($('#'+topRightSplitId).width() - 20);
  70 + e.stopPropagation();
  71 + });
  72 + $('#'+topRightSplitId).bind('resize', function(e) {
  73 + e.stopPropagation();
  74 + });
  75 + $('#'+topVSplitterId).splitter({
  76 + type: "v",
  77 + minLeft: 50,
  78 + sizeLeft: w/2,
  79 + resizeToWidth: true,
  80 + outline: true
  81 + });
  82 + }
  83 +}
  84 +
  85 +function createVBottomSplitter() {
  86 + var w=$('#'+bottomVSplitterId).width();
  87 + $('#'+bottomVSplitterId).height($('#right').height()/3);
  88 + if ($.fn.splitter) {
  89 + $('#'+bottomLeftSplitId).bind('resize', function(e) {
  90 + $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
  91 + $('#'+bottomVSplitterId).children().each(function () {
  92 + $(this).height($('#'+bottomSplitId).height()-7);
  93 + });
  94 +
  95 + $('#'+bottomLeftSplitId).width($('#'+bottomLeftSplitId).width() - 7);
  96 + $('#'+bottomRightSplitId).width($('#'+bottomRightSplitId).width() - 20);
  97 + e.stopPropagation();
  98 + });
  99 + $('#'+bottomRightSplitId).bind('resize', function(e) {
  100 + e.stopPropagation();
  101 + });
  102 + $('#'+bottomVSplitterId).splitter({
  103 + type: "v",
  104 + sizeLeft: w/3,
  105 + minLeft: 200,
  106 + resizeToWidth: true,
  107 + outline: true
  108 + });
  109 + }
  110 +}
... ...
semantics/static/js/semantics_view.js
... ... @@ -1534,114 +1534,3 @@ function frame_id(class_id) {
1534 1534 function value_compare(a, b) {
1535 1535 return b.value - a.value;
1536 1536 }
1537   -
1538   -/////////////////////////// Splitters ///////////////////////////
1539   -
1540   -var hSplitterId = 'semantics-hsplit';
1541   -var topSplitId = 'semantics-hsplit-top';
1542   -var bottomSplitId = 'semantics-hsplit-bottom';
1543   -var topVSplitterId = 'semantics-vsplit-top';
1544   -var bottomVSplitterId = 'semantics-vsplit-bottom';
1545   -var topLeftSplitId = 'frames';
1546   -var topRightSplitId = 'schemas';
1547   -var bottomLeftSplitId = 'control';
1548   -var bottomRightSplitId = 'semantics-examples';
1549   -
1550   -function createHSplitter() {
1551   - $('#'+hSplitterId).height($('#right').height() - 70);
1552   -
1553   - if ($.fn.splitter) {
1554   -
1555   - $(window).resize(function() {
1556   - $('#'+hSplitterId).height($('#right').height() - 70);
1557   - });
1558   -
1559   - $('#'+hSplitterId).bind('resize', function(e) {
1560   - var resizeEvt;
1561   - clearTimeout(resizeEvt);
1562   - resizeEvt = setTimeout(function() {
1563   - $('#'+topVSplitterId).trigger('resize', $('#'+topLeftSplitId).width());
1564   - $('#'+bottomVSplitterId).trigger('resize', $('#'+bottomLeftSplitId).width()+7);
1565   - }, 50);
1566   - e.stopPropagation();
1567   - });
1568   -
1569   - $('#'+topSplitId).bind('resize', function(e) {
1570   - $('#'+topVSplitterId).height($('#'+topSplitId).height());
1571   - $('#'+topVSplitterId).children().each(function () {
1572   - $(this).height($('#'+topSplitId).height() - 7);
1573   - });
1574   -
1575   - $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
1576   - $('#'+bottomVSplitterId).children().each(function () {
1577   - $(this).height($('#'+bottomSplitId).height() - 7);
1578   - });
1579   - e.stopPropagation();
1580   - });
1581   - $('#'+bottomSplitId).bind('resize', function(e) {
1582   - e.stopPropagation();
1583   - });
1584   - $('#'+hSplitterId).splitter({
1585   - type: "h",
1586   - minTop: 200,
1587   - minBottom: 100,
1588   - sizeBottom: 170,
1589   - resizeToWidth: true,
1590   - outline: true
1591   - });
1592   - }
1593   -}
1594   -
1595   -function createVTopSplitter() {
1596   - var w=$('#'+topVSplitterId).width();
1597   -
1598   - $('#'+topVSplitterId).height(2*$('#right').height()/3);
1599   -
1600   - if ($.fn.splitter) {
1601   - $('#'+topLeftSplitId).bind('resize', function(e) {
1602   - $('#'+topVSplitterId).height($('#'+topSplitId).height());
1603   - $('#'+topVSplitterId).children().each(function () {
1604   - $(this).height($('#'+topSplitId).height() - 7);
1605   - });
1606   - $('#'+topRightSplitId).width($('#'+topRightSplitId).width() - 20);
1607   - e.stopPropagation();
1608   - });
1609   - $('#'+topRightSplitId).bind('resize', function(e) {
1610   - e.stopPropagation();
1611   - });
1612   - $('#'+topVSplitterId).splitter({
1613   - type: "v",
1614   - minLeft: 50,
1615   - sizeLeft: w/2,
1616   - resizeToWidth: true,
1617   - outline: true
1618   - });
1619   - }
1620   -}
1621   -
1622   -function createVBottomSplitter() {
1623   - var w=$('#'+bottomVSplitterId).width();
1624   - $('#'+bottomVSplitterId).height($('#right').height()/3);
1625   - if ($.fn.splitter) {
1626   - $('#'+bottomLeftSplitId).bind('resize', function(e) {
1627   - $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
1628   - $('#'+bottomVSplitterId).children().each(function () {
1629   - $(this).height($('#'+bottomSplitId).height()-7);
1630   - });
1631   -
1632   - $('#'+bottomLeftSplitId).width($('#'+bottomLeftSplitId).width() - 7);
1633   - $('#'+bottomRightSplitId).width($('#'+bottomRightSplitId).width() - 20);
1634   - e.stopPropagation();
1635   - });
1636   - $('#'+bottomRightSplitId).bind('resize', function(e) {
1637   - e.stopPropagation();
1638   - });
1639   - $('#'+bottomVSplitterId).splitter({
1640   - type: "v",
1641   - sizeLeft: w/3,
1642   - minLeft: 200,
1643   - resizeToWidth: true,
1644   - outline: true
1645   - });
1646   - }
1647   -}
... ...
semantics/views.py
... ... @@ -31,7 +31,7 @@ def ajax_semantics(request, id):
31 31 context = {}
32 32 lemma = Lemma.objects.get(id=id)
33 33 context['lemma'] = lemma
34   - context['can_modify'] = (user_can_modify(lemma, request.user) and
  34 + context['can_modify'] = (user_can_modify(lemma, request.user) and
35 35 lemma.status.stage_of_work.sym_name == 'semantics')
36 36 context['js_vars'] = {
37 37 'ajax_frames': reverse('ajax_frames'),
... ...
static/js/entry-layout.js 0 → 100644
  1 +var myLayout;
  2 +var change = false;
  3 +var notesNotSaved = false;
  4 +var lemmaExNotSaved = false;
  5 +var frames_operations = [];
  6 +
  7 +$(window).bind('beforeunload', function() {
  8 + warnings = ""
  9 + if(change)
  10 + warnings = warnings + " - Nie zapisano zmian w schematach składniowych.\n";
  11 + if(typeof semanticsChanged != "undefined" && semanticsChanged())
  12 + warnings = warnings + " - Nie zapisano zmian w ramach semantycznych.\n";
  13 + if(notesNotSaved)
  14 + warnings = warnings + " - Nie zapisano notatki.\n";
  15 + if(lemmaExNotSaved)
  16 + warnings = warnings + " - Nie zapisano przykładu niedowiązangeo.\n";
  17 + if(warnings)
  18 + return "Uwaga:\n" + warnings
  19 + });
  20 +
  21 +$(function() {
  22 + $('#content').height($(window).height() - 20);
  23 + $(window).resize(function() {
  24 + $('#content').height($(window).height() - 20);
  25 + resize_splitters();
  26 + });
  27 + if ($.fn.splitter) {
  28 + $('#content').bind('resize', function(e) {
  29 + resize_splitters();
  30 + e.stopPropagation();
  31 + });
  32 + $('#content').bind('resize', function(e) {
  33 + e.stopPropagation();
  34 + });
  35 + }
  36 +});
  37 +
  38 +function ShowProgressAnimation()
  39 +{
  40 + $("#wait-dialog").dialog('open');
  41 +}
  42 +
  43 +function HideProgressAnimation()
  44 +{
  45 + $("#wait-dialog").dialog('close');
  46 +}
  47 +
  48 +function resize_splitters() {
  49 + $('#semantics-hsplit').trigger('resize');
  50 +}
  51 +
  52 +function createWaitDialog()
  53 +{
  54 + $("#wait-dialog").dialog({ autoOpen: false,
  55 + modal : 'true',
  56 + closeOnEscape: 'false',
  57 + closeText: '',
  58 + bgiframe: 'true',
  59 + resizable: 'false',
  60 + open: function (event, ui) {
  61 + $('#wait-dialog').css('overflow', 'hidden');
  62 + }});
  63 + $(".ui-dialog-titlebar").hide();
  64 +}
  65 +
  66 +function refresh_column_headers() {}
  67 +
  68 +function load_content(id) {
  69 + $('#add-table-elem-dialog').dialog('close');
  70 + if(lemma_id != id)
  71 + $('#ready-note-dialog').dialog('close');
  72 + initiateFrameFilters();
  73 +
  74 + ShowProgressAnimation();
  75 + // czyszczenie wartosci
  76 + window.elem_in_bucket = '';
  77 + window.selected_notes_row_id = -1;
  78 + window.selected_id = -1;
  79 + window.prev_selected_id = -1;
  80 + window.edited_id = -1;
  81 + window.manipulated_id = -1;
  82 + window.new_elem_id = -2;
  83 + window.copy_elem_id = -1;
  84 + window.activeNewFramePanel = 'frames_modif';
  85 + window.selectedArgumentsIdNkjp = new Array();
  86 + window.selectedFrameIdNkjp = -1;
  87 + window.nkjp_examples = new Array();
  88 + window.curr_example_id = -1;
  89 + window.selected_example_id = -1;
  90 + window.lemma_nkjp_examples = new Array();
  91 + window.curr_lemma_example_id = -1;
  92 + window.selected_lemma_example_id = -1;
  93 + window.addedFrame = '';
  94 +
  95 + $('#new_frames').empty();
  96 + window.change = false;
  97 + window.notesNotSaved = false;
  98 + window.lemmaExNotSaved = false;
  99 +
  100 + $('#new_frames').load(ajax_new_frames, 'id='+id, function(data){
  101 + window.lemma_id = id;
  102 +
  103 + loadSchemataAndExamples();
  104 +
  105 + createSplitter('framesSplit','new-frame-tables', 'tabs');
  106 +
  107 + if(document.getElementById("lemma_example_show"))
  108 + {
  109 + draw_nkjp_table(document.getElementById("lemma_example_show"), '', window.nkjp_lemma_examples, 'NkjpLemmaTableRow', 'nkjpLemma_')
  110 + $("tr.NkjpLemmaTableRow").click(function(){
  111 + selectLemmaNkjpTr(this.id)});
  112 + }
  113 + addPinnedExamplesDialog();
  114 + $('#lemma_desc').load(ajax_get_lemma_desc, 'id='+id);
  115 + areNewPreviewEntriesRelated();
  116 + refresh_example_propositions();
  117 + });
  118 + $('#semantics').load(ajax_semantics, 'id='+id);
  119 +}
  120 +
  121 +function createSplitter(split_id, top_id, bottom_id) {
  122 + $('#'+split_id).height($('#content').height() - 50);
  123 + if ($.fn.splitter) {
  124 + $(window).resize(function() {
  125 + $('#'+split_id).height($('#content').height() - 50);
  126 + });
  127 + $('#'+top_id).bind('resize', function(e) {
  128 + e.stopPropagation();
  129 + });
  130 + $('#'+bottom_id).bind('resize', function(e) {
  131 + e.stopPropagation();
  132 + });
  133 + $('#'+split_id).splitter({
  134 + type: "h",
  135 + minTop: 200,
  136 + minBottom: 50,
  137 + sizeBottom: 170,
  138 + resizeToWidth: true
  139 + });
  140 + }
  141 +}
  142 +
  143 +
  144 +var hSplitterId = 'semantics-hsplit';
  145 +var topSplitId = 'semantics-hsplit-top';
  146 +var bottomSplitId = 'semantics-hsplit-bottom';
  147 +var topVSplitterId = 'semantics-vsplit-top';
  148 +var bottomVSplitterId = 'semantics-vsplit-bottom';
  149 +var topLeftSplitId = 'frames';
  150 +var topRightSplitId = 'schemas';
  151 +var bottomLeftSplitId = 'control';
  152 +var bottomRightSplitId = 'semantics-examples';
  153 +
  154 +function createHSplitter() {
  155 + $('#'+hSplitterId).height($('#content').height() - 50);
  156 +
  157 + if ($.fn.splitter) {
  158 +
  159 + $(window).resize(function() {
  160 + $('#'+hSplitterId).height($('#content').height() - 50);
  161 + });
  162 +
  163 + $('#'+hSplitterId).bind('resize', function(e) {
  164 + var resizeEvt;
  165 + clearTimeout(resizeEvt);
  166 + resizeEvt = setTimeout(function() {
  167 + $('#'+topVSplitterId).trigger('resize', $('#'+topLeftSplitId).width());
  168 + $('#'+bottomVSplitterId).trigger('resize', $('#'+bottomLeftSplitId).width()+7);
  169 + }, 50);
  170 + e.stopPropagation();
  171 + });
  172 +
  173 + $('#'+topSplitId).bind('resize', function(e) {
  174 + $('#'+topVSplitterId).height($('#'+topSplitId).height());
  175 + $('#'+topVSplitterId).children().each(function () {
  176 + $(this).height($('#'+topSplitId).height() - 7);
  177 + });
  178 +
  179 + $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
  180 + $('#'+bottomVSplitterId).children().each(function () {
  181 + $(this).height($('#'+bottomSplitId).height() - 7);
  182 + });
  183 + e.stopPropagation();
  184 + });
  185 + $('#'+bottomSplitId).bind('resize', function(e) {
  186 + e.stopPropagation();
  187 + });
  188 + $('#'+hSplitterId).splitter({
  189 + type: "h",
  190 + minTop: 200,
  191 + minBottom: 100,
  192 + sizeBottom: 170,
  193 + resizeToWidth: true,
  194 + outline: true
  195 + });
  196 + }
  197 +}
  198 +
  199 +function createVTopSplitter() {
  200 + var w=$('#'+topVSplitterId).width();
  201 +
  202 + $('#'+topVSplitterId).height(2*$('#content').height()/3);
  203 +
  204 + if ($.fn.splitter) {
  205 + $('#'+topLeftSplitId).bind('resize', function(e) {
  206 + $('#'+topVSplitterId).height($('#'+topSplitId).height());
  207 + $('#'+topVSplitterId).children().each(function () {
  208 + $(this).height($('#'+topSplitId).height() - 7);
  209 + });
  210 + $('#'+topRightSplitId).width($('#'+topRightSplitId).width() - 20);
  211 + e.stopPropagation();
  212 + });
  213 + $('#'+topRightSplitId).bind('resize', function(e) {
  214 + e.stopPropagation();
  215 + });
  216 + $('#'+topVSplitterId).splitter({
  217 + type: "v",
  218 + minLeft: 50,
  219 + sizeLeft: w/2,
  220 + resizeToWidth: true,
  221 + outline: true
  222 + });
  223 + }
  224 +}
  225 +
  226 +function createVBottomSplitter() {
  227 + var w=$('#'+bottomVSplitterId).width();
  228 + $('#'+bottomVSplitterId).height($('#content').height()/3);
  229 + if ($.fn.splitter) {
  230 + $('#'+bottomLeftSplitId).bind('resize', function(e) {
  231 + $('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
  232 + $('#'+bottomVSplitterId).children().each(function () {
  233 + $(this).height($('#'+bottomSplitId).height()-7);
  234 + });
  235 +
  236 + $('#'+bottomLeftSplitId).width($('#'+bottomLeftSplitId).width() - 7);
  237 + $('#'+bottomRightSplitId).width($('#'+bottomRightSplitId).width() - 20);
  238 + e.stopPropagation();
  239 + });
  240 + $('#'+bottomRightSplitId).bind('resize', function(e) {
  241 + e.stopPropagation();
  242 + });
  243 + $('#'+bottomVSplitterId).splitter({
  244 + type: "v",
  245 + sizeLeft: w/3,
  246 + minLeft: 200,
  247 + resizeToWidth: true,
  248 + outline: true
  249 + });
  250 + }
  251 +}
... ...
templates/base.html
... ... @@ -9,6 +9,7 @@
9 9 <script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery.scrollTo-min.js"></script>
10 10 <script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery.hotkeys.js"></script>
11 11 <script type="text/javascript" src="{{ STATIC_URL }}js/base-layout.js"></script>
  12 +<script type="text/javascript" src="{{ STATIC_URL }}js/semantics_splitters.js"></script>
12 13 <script type="text/javascript" src="{{ STATIC_URL }}js/argument_form_utils.js"></script>
13 14 <script type="text/javascript" src="{{ STATIC_URL }}js/script.js"></script>
14 15 {% load script json %}
... ...
templates/entry.html 0 → 100644
  1 +{% load url from future %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2 +<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="pl" lang="pl">
  3 +<head>
  4 +<title>{% block title %}{% endblock %}</title>
  5 +<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  6 +<script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery-1.7.1.js"></script>
  7 +<script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery.json-2.2.min.js"></script>
  8 +<script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery-ui-1.8.20.custom.min.js"></script>
  9 +<script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery.scrollTo-min.js"></script>
  10 +<script type="text/javascript" src="{{ STATIC_URL }}js/argument_form_utils.js"></script>
  11 +<script type="text/javascript" src="{{ STATIC_URL }}js/script.js"></script>
  12 +{% load script json %}
  13 +{% if js_vars %}
  14 + {% script %}
  15 + {% for name,var in js_vars.iteritems %}
  16 + var {{ name }} = {{ var|jsonify }};
  17 + {% endfor %}
  18 + {% endscript %}
  19 +{% endif %}
  20 +<link rel="shortcut icon" href="{{STATIC_URL}}images/favicon.ico" type="image/png"/>
  21 +<link rel="stylesheet" href="{{ STATIC_URL }}css/lib/smoothness/jquery-ui-1.8.20.custom.css" type="text/css" media="screen" charset="utf-8" />
  22 +<link rel="stylesheet" href="{{ STATIC_URL }}css/general.css" type="text/css" media="screen" charset="utf-8" />
  23 +<link rel="stylesheet" href="{{ STATIC_URL }}css/status_table.css" type="text/css" media="screen" charset="utf-8" />
  24 +<link rel="stylesheet" href="{{ STATIC_URL }}css/vocabulary_stats.css" type="text/css" media="screen" charset="utf-8" />
  25 +<link rel="stylesheet" href="{{ STATIC_URL }}css/user_stats.css" type="text/css" media="screen" charset="utf-8" />
  26 +<link rel="stylesheet" href="{{ STATIC_URL }}css/frame_table.css" type="text/css" media="screen" charset="utf-8" />
  27 +<link rel="stylesheet" href="{{ STATIC_URL }}css/arg_realization_table.css" type="text/css" media="screen" charset="utf-8" />
  28 +<link rel="stylesheet" href="{{ STATIC_URL }}css/arg_realization_viewtab.css" type="text/css" media="screen" charset="utf-8" />
  29 +<link rel="stylesheet" href="{{ STATIC_URL }}css/all_notes_table.css" type="text/css" media="screen" charset="utf-8" />
  30 +
  31 +<script>
  32 + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  33 + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  34 + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  35 + })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  36 +
  37 + ga('create', 'UA-49926765-2', 'auto');
  38 + ga('send', 'pageview');
  39 +
  40 + $(document).ready( function() {
  41 + if (userIsAuthenticated()) {
  42 + $('#wait-dialog h2').text('Ten widok nie jest przeznaczony dla zalogowanych użytkowników.');
  43 + } else if (error) {
  44 + $('#wait-dialog h2').text(error);
  45 + } else {
  46 + createWaitDialog();
  47 + load_content(lemma);
  48 + }
  49 + });
  50 +</script>
  51 +
  52 + <link rel="stylesheet" href="{{ STATIC_URL }}css/lib/ui.jqgrid.css" type="text/css" media="screen" charset="utf-8" />
  53 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/lib/jquery.multiselect.css"/>
  54 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/jqgrid.css"/>
  55 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/change_ctrl_table.css"/>
  56 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/examples_table.css"/>
  57 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/aspect_relations_table.css"/>
  58 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/filter_frames_menu.css"/>
  59 + <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/lemmas_filtering.css"/>
  60 + <script type="text/javascript" src="{{ STATIC_URL }}js/lib/splitter.js"></script>
  61 + <script type="text/javascript" src="{{ STATIC_URL }}js/lib/jquery.multiselect.js"></script>
  62 +
  63 + <script type="text/javascript" src="{{ STATIC_URL }}js/semantics_coupling.js"></script>
  64 + <script type="text/javascript" src="{{ STATIC_URL }}js/lemma-view.js"></script>
  65 + <script type="text/javascript" src="{{ STATIC_URL }}js/entry-layout.js"></script>
  66 + <script type="text/javascript" src="{{ STATIC_URL }}js/lemmas_filtering.js"></script>
  67 + <script type="text/javascript" src="{{ STATIC_URL }}js/schemata_filtering.js"></script>
  68 +</head>
  69 +{% load i18n %}
  70 +
  71 +<body>
  72 +<!-- Container -->
  73 +<!--div id="container"-->
  74 +
  75 + <!-- Header -->
  76 + <div id="header">
  77 + </div>
  78 + <!-- END Header -->
  79 + <!-- Content -->
  80 +<div id="content">
  81 + <div class="tabs">
  82 + <ul>
  83 + <li id="refresh_frames"><a href="#new_frames">{% trans "Składnia" %} [<span id="new-frames-count"></span>]</a></li>
  84 + <li><a href="#semantics">{% trans "Semantyka" %} [<span id="semantic-frames-count"></span>]</a></li>
  85 + <li><a href="#examples">{% trans "Przykłady" %} [<span id="lemma-examples-count"></span>]</a></li>
  86 + <li id="lemma_desc" style="float:right;"></li>
  87 + </ul>
  88 + <div id="new_frames">
  89 + </div>
  90 + <div id="semantics">
  91 + </div>
  92 + <div id="examples">
  93 + </div>
  94 + </div>
  95 + </div>
  96 + <!-- END Content -->
  97 +
  98 + {% block footer %}<div id="footer"></div>{% endblock %}
  99 +<!--/div-->
  100 +<!-- END Container -->
  101 + <div id="wait-dialog">
  102 + <div id="progress" class="ui-corner-all" >
  103 + <h2 style="color:gray;font-weight:normal;">Proszę czekać....</h2>
  104 + </div>
  105 + </div>
  106 +
  107 +</body>
  108 +</html>
... ...
... ... @@ -26,6 +26,8 @@ urlpatterns = patterns(&#39;&#39;,
26 26  
27 27 (r'^robots\.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
28 28  
  29 + (r'^entry/$', 'dictionary.views.entry'),
  30 +
29 31 # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
30 32 # to INSTALLED_APPS to enable admin documentation:
31 33 # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
... ...