Commit 6d57684eac6dfee9a0e13d39df7506e5f6a0deb3

Authored by kevin_fourie
1 parent 3bff6839

Merged in from STABLE trunk...

KTS-3535
"Removing Yahoo UI resulted in saved search ajax functionality not working"
Fixed.  Re-implemented using Extjs ajax.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3-Release-Branch@8897 c91229c3-7414-0410-bfa2-8a42b809f60b
templates/ktcore/search2/adv_query_search.smarty
... ... @@ -47,7 +47,15 @@ var gotSearchParseStatus = function callBack(o)
47 47 var txtQuery = document.getElementById('txtAdvQuery');
48 48 url='{/literal}{$rootUrl}{literal}/search2/ajax/saveExpr.php?iSavedId={/literal}{$iSavedSearchId}{literal}&txtQuery='+txtQuery.value;
49 49 //alert(url);
50   - YAHOO.util.Connect.asyncRequest('GET',url, searchCallback);
  50 +
  51 + Ext.Ajax.request(
  52 + {
  53 + url: url,
  54 + method: 'GET',
  55 + success:gotSearchParseStatus,
  56 + failure:gotNoStatus
  57 + });
  58 +
51 59 }
52 60 else if (actionAfterParse == 'saveCompleted')
53 61 {
... ... @@ -73,11 +81,6 @@ var gotNoStatus = function callBack(o)
73 81 alert('{/literal}{i18n}There is a problem communicating with the server.{/i18n}{literal}' + o.responseText);
74 82 }
75 83  
76   -var searchCallback =
77   -{
78   - success:gotSearchParseStatus,
79   - failure:gotNoStatus
80   -}
81 84 function startParsing()
82 85 {
83 86 if (!parseSuccess)
... ... @@ -87,7 +90,14 @@ function startParsing()
87 90 }
88 91 var txtQuery = document.getElementById('txtAdvQuery');
89 92 url='{/literal}{$rootUrl}{literal}/search2/ajax/parseExpr.php?txtQuery='+txtQuery.value;
90   - YAHOO.util.Connect.asyncRequest('GET',url, searchCallback);
  93 +
  94 + Ext.Ajax.request(
  95 + {
  96 + url: url,
  97 + method: 'GET',
  98 + success:gotSearchParseStatus,
  99 + failure:gotNoStatus
  100 + });
91 101 }
92 102 function butParseClick()
93 103 {
... ...
templates/ktcore/search2/search_results.smarty
1   -{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/MochiKitPacked.js')}
2 1 {$context->oPage->requireJSResource('resources/js/toggleselect.js')}
3 2  
4 3 <div class="collapsible">
... ... @@ -35,35 +34,6 @@
35 34 {/if}
36 35 {literal}
37 36 <script language="javascript">
38   -var savesearch_gotStatus = function callBack(o)
39   -{
40   - if (o.responseText != '{}')
41   - {
42   - var resp = eval('(' + o.responseText + ')');
43   -
44   - if (resp.status == 0)
45   - {
46   - parseSuccess = true;
47   - $('saveSearch').style.display='none';
48   - $('savedSearch').style.display='block';
49   - //alert('{/literal}{i18n}The search expression has been saved.{/i18n}{literal}');
50   - }
51   - else
52   - {
53   - alert('{/literal}{i18n}There is a problem saving the expression expression.{/i18n}{literal}\n\n' + resp.message );
54   - }
55   - }
56   -}
57   -var savesearch_gotNoStatus = function callBack(o)
58   -{
59   - alert('{/literal}{i18n}There is a problem communicating with the server.{/i18n}{literal}' + o.responseText);
60   -}
61   -
62   -var saveSearchCallback =
63   -{
64   - success:savesearch_gotStatus,
65   - failure:savesearch_gotNoStatus
66   -}
67 37 function saveSearch()
68 38 {
69 39 var txtName = $('txtSaveName');
... ... @@ -74,7 +44,35 @@ function saveSearch()
74 44 return;
75 45 }
76 46 url='{/literal}{$rootUrl}{literal}/search2/ajax/saveExpr.php?txtName='+ txtName.value +'&txtQuery={/literal}{$txtQuery|escape:'quotes'}{literal}';
77   - YAHOO.util.Connect.asyncRequest('GET',url, saveSearchCallback);
  47 +
  48 + Ext.Ajax.request(
  49 + {
  50 + url: url,
  51 + method: 'GET',
  52 + success: function callBack(o)
  53 + {
  54 + if (o.responseText != '{}')
  55 + {
  56 + var resp = eval('(' + o.responseText + ')');
  57 +
  58 + if (resp.status == 0)
  59 + {
  60 + parseSuccess = true;
  61 + $('saveSearch').style.display='none';
  62 + $('savedSearch').style.display='block';
  63 + //alert('{/literal}{i18n}The search expression has been saved.{/i18n}{literal}');
  64 + }
  65 + else
  66 + {
  67 + alert('{/literal}{i18n}There is a problem saving the expression expression.{/i18n}{literal}\n\n' + resp.message );
  68 + }
  69 + }
  70 + },
  71 + failure: function(o)
  72 + {
  73 + alert('{/literal}{i18n}There is a problem communicating with the server.{/i18n}{literal}' + o.responseText);
  74 + }
  75 + });
78 76 }
79 77  
80 78 function onSelectAll()
... ...