Changeset 26347


Ignore:
Timestamp:
06/13/10 00:49:54 (7 years ago)
Author:
rambo
Message:

we need to pass the chooser widget id back to the parent in order to use it

Location:
branches/ragnaroek/midcom/net.hurttakallio.library/style
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ragnaroek/midcom/net.hurttakallio.library/style/nhl-include-common_footer.php

    r26345 r26347  
    66}
    77// Only chooser has legitimate reason to use GET for defaults
    8 if (isset($_GET['defaults']))
     8if (isset($_GET['chooser_widget_id']))
    99{
    1010?>
    1111        <!-- Since the raw mode is usually called from chooser include what it needs, copied from n.n.calendar and does not quite seems to work -->
    1212        <script type="text/javascript">
    13             // TODO: override the DM form cancel button to close the dialog
    14         /*
    15         try
    16         {
    17         */
    18             <?php
     13            jQuery('input.cancel').click
     14            (
     15                function (e)
     16                {
     17                    e.preventDefault();
     18                    window.parent.close_dialog("&(_GET['chooser_widget_id']);");
     19                    return false;
     20                }
     21            );
     22<?php
    1923            if (isset($data['object']))
    2024            {
    2125                $obj =& $data['object'];
    2226                $json = "{ id: '{$obj->id}', guid: '{$obj->guid}', pre_selected: true, title: '" . str_replace("'", "\'", rawurlencode($obj->title)) . "' }";
    23                 echo "            window.parent.add_item({$json});";
     27                echo "            window.parent.add_item({$json}, '{$_GET['chooser_widget_id']}');";
    2428                unset($json, $obj);
    2529            }
    2630            if ($data['mode'] != 'create')
    2731            {
    28                 echo "            window.parent.close_dialog();\n";
     32                echo "            window.parent.close_dialog('{$_GET['chooser_widget_id']}');\n";
    2933            }
    30             ?>
    31         /*
    32         }
    33         catch (e) { }
    34         */
     34?>
    3535        </script>
    3636<?php
  • branches/ragnaroek/midcom/net.hurttakallio.library/style/nhl-include-common_header.php

    r26345 r26347  
    1414    </head>
    1515    <body class="<?php echo $_MIDCOM->metadata->get_page_class(); ?>" <?php $_MIDCOM->print_jsonload(); ?>>
    16        
    1716<?php
    18 if (isset($_GET['defaults']))
     17if (isset($_GET['chooser_widget_id']))
    1918{
    20     echo "        <input type='button' onclick='window.parent.jQuery(\"div.chooser_widget_creation_dialog:visible\").hide();' value='X' style='float: right;' class='close' />\n";
     19    echo "        <input type='button' onclick='window.parent.close_dialog(\"{$_GET['chooser_widget_id']}\"); return false;' value='X' style='float: right;' class='close' />\n";
    2120}
    2221?>
Note: See TracChangeset for help on using the changeset viewer.