diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-02-28 17:31:23 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-05-06 16:22:17 +0200 |
commit | 7edf044a440d9a7f60c691811acedfc6a20ecbfe (patch) | |
tree | 49671a0728b141374fcd10f294d9220a3415042b | |
parent | 693dc560620d52dc24a0ab89e20147b10ed4f469 (diff) | |
download | freeipa-7edf044a440d9a7f60c691811acedfc6a20ecbfe.tar.gz freeipa-7edf044a440d9a7f60c691811acedfc6a20ecbfe.tar.xz freeipa-7edf044a440d9a7f60c691811acedfc6a20ecbfe.zip |
Removed old navigation code
https://fedorahosted.org/freeipa/ticket/3236
-rw-r--r-- | install/ui/index.html | 1 | ||||
-rw-r--r-- | install/ui/src/freeipa/app.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/navigation.js | 460 | ||||
-rw-r--r-- | install/ui/src/freeipa/webui.js | 136 | ||||
-rw-r--r-- | install/ui/src/libs/Makefile.am | 1 | ||||
-rw-r--r-- | install/ui/src/libs/jquery.ba-bbq.js | 18 |
6 files changed, 0 insertions, 618 deletions
diff --git a/install/ui/index.html b/install/ui/index.html index 0523df4d..75ff8299 100644 --- a/install/ui/index.html +++ b/install/ui/index.html @@ -16,7 +16,6 @@ <script type="text/javascript" src="js/libs/json2.js"></script> <script type="text/javascript" src="js/libs/jquery.js"></script> <script type="text/javascript" src="js/libs/jquery-ui.js"></script> - <script type="text/javascript" src="js/libs/jquery.ba-bbq.js"></script> <script type="text/javascript" src="js/libs/jquery.ordered-map.js"></script> <script type="text/javascript" src="js/libs/browser.js"></script> diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js index 88c8c2ba..361d2371 100644 --- a/install/ui/src/freeipa/app.js +++ b/install/ui/src/freeipa/app.js @@ -30,8 +30,6 @@ define([ 'exports', // for circullar deps './ipa', './jquery', - './navigation', - './webui', //only entities './aci', './automember', diff --git a/install/ui/src/freeipa/navigation.js b/install/ui/src/freeipa/navigation.js deleted file mode 100644 index 910fb79e..00000000 --- a/install/ui/src/freeipa/navigation.js +++ /dev/null @@ -1,460 +0,0 @@ -/*jsl:import ipa.js */ - -/* Authors: - * Pavel Zuna <pzuna@redhat.com> - * Endi S. Dewata <edewata@redhat.com> - * - * Copyright (C) 2010 Red Hat - * see file 'COPYING' for use and warranty information - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -define(['./ipa', './jquery'], function(IPA, $) { - -IPA.navigation = function(spec) { - - spec = spec || {}; - - var that = {}; - - that.name = spec.name; - - that.container = spec.container; - that.root = that.container.attr('id'); - - that.content = spec.content; - that.tab_class = spec.tab_class || 'tabs'; - that.max_depth = spec.max_depth || 3; - - that.tabs = []; - that.tabs_by_name = {}; - - that.path = {}; - - that.set_tabs = function(tabs) { - that.tabs = tabs; - that.tabs_by_name = {}; - - for (var i=0; i<tabs.length; i++) { - that.add_tab(tabs[i]); - } - }; - - that.add_tab = function(tab, parent) { - if (!tab.name) { - tab.name = tab.entity; - } - tab.parent = parent; - - that.tabs_by_name[tab.name] = tab; - - for (var i=0; tab.children && i<tab.children.length; i++) { - that.add_tab(tab.children[i], tab); - } - }; - - that.get_tab = function(name) { - return that.tabs_by_name[name]; - }; - - that.get_active_tab = function(state) { - var name = null; - var next = state[that.root]; - - while (next) { - name = next; - next = state[name]; - } - - return that.get_tab(name); - }; - - that.is_ancestor = function(tab, ancestor) { - var parent = tab.parent; - while (parent) { - if (parent == ancestor) return true; - parent = parent.parent; - } - return false; - }; - - that.get_path_state = function(name) { - - var path_state = {}; - - var tab = that.get_tab(name); - var parent = tab.parent; - - while (parent) { - path_state[parent.name] = tab.name; - - tab = parent; - parent = tab.parent; - } - - path_state[that.root] = tab.name; - - return path_state; - }; - - that.push_state = function(params) { - - var param_path = {}; - var param_state = {}; - - for (var key in params) { - var value = params[key]; - if (key.indexOf('-') < 0) { - param_path[key] = value; - } else { - param_state[key] = value; - } - } - - var state = {}; - - var prev_entity = IPA.current_entity; - var prev_facet = prev_entity ? prev_entity.facet : null; - - if (prev_facet) { - - if (prev_facet.is_dirty()) { - var dialog = IPA.dirty_dialog({ - facet: prev_facet - }); - - dialog.callback = function() { - - // Some facet's might not call reset before this call but after - // so they are still dirty. Calling reset prevent's opening of - // dirty dialog again. - if (prev_facet.is_dirty()) prev_facet.reset(); - $.bbq.pushState(params); - }; - - dialog.open(that.container); - - return false; - } - - // get prev facet state - $.extend(state, prev_facet.state); - } - - // merge existing path with new path - $.extend(that.path, param_path); - - // find the tab pointed by the path - var tab = that.get_active_tab(that.path); - - // find the active tab at the lowest level - while (!tab.entity) { - var index = tab.container.tabs('option', 'selected'); - tab = tab.children[index]; - } - - var facet_name; - if (tab.entity == prev_entity) { - // merge prev facet state with new state to find new facet name - $.extend(state, param_state); - facet_name = state[tab.entity.name+'-facet']; - - } else { - // find new facet name in the new state - facet_name = param_state[tab.entity.name+'-facet']; - } - - var facet = tab.entity.get_facet(facet_name); - - // update new facet state with new state - $.extend(facet.state, param_state); - - var entity = tab.entity.get_containing_entity(); - while (entity) { - var facet2 = entity.get_facet(); - - var key_names = entity.get_key_names(); - for (var i=0; i<key_names.length; i++) { - var key_name = key_names[i]; - var key_value = param_state[key_name]; - if (!key_value) key_value = facet2.state[key_name]; - if (key_value) facet.state[key_name] = key_value; - } - - entity = entity.get_containing_entity(); - } - - // push entity path and facet state - state = {}; - $.extend(state, that.get_path_state(tab.name)); - $.extend(state, facet.state); - $.bbq.pushState(state, 2); - - return true; - }; - - that.get_state = function(key) { - return $.bbq.getState(key); - }; - - that.remove_state = function(key) { - $.bbq.removeState(key); - }; - - that.show_tab = function(tab_name, pkey) { - - var tab = that.get_tab(tab_name); - - var state = that.get_path_state(tab.name); - - if (tab.entity) { - - if (tab.facet) { - state[tab.entity.name + '-facet'] = tab.facet; - } - - if (pkey) { - state[tab.entity.name + '-pkey'] = pkey; - } - } - - return that.push_state(state); - }; - - that.show_page = function(entity_name, facet_name, pkey) { - var state = that.get_path_state(entity_name); - - if (facet_name) { - state[entity_name + '-facet'] = facet_name; - } - - if (pkey) { - state[entity_name + '-pkey'] = pkey; - } - - return that.push_state(state); - }; - - /*like show page, but works for nested entities */ - that.show_entity_page = function(entity, facet_name, pkeys) { - var state = that.get_path_state(entity.name); - - if (facet_name) { - state[entity.name + '-facet'] = facet_name; - } - - if (pkeys) { - if (pkeys instanceof Array){ - var current_entity = entity; - while (current_entity){ - state[current_entity.name + '-pkey'] = pkeys.pop(); - current_entity = current_entity.get_containing_entity(); - } - }else{ - state[entity.name + '-pkey'] = pkeys; - } - } - - return that.push_state(state); - }; - - that.show_top_level_page = function() { - jQuery.bbq.pushState({}, 2); - }; - - that.get_tab_facet = function(tab_name) { - - var facet = null; - var tab = that.get_tab(tab_name); - - if (tab.entity) { - if (tab.facet) { - facet = tab.entity.get_facet(tab.facet); - } else { - facet = tab.entity.get_facet(tab.entity.redirect_facet); - } - } - - return facet; - }; - - - that.create = function() { - - var container = $('<div/>', { - name: that.root - }).appendTo(that.container); - - that._create(that.tabs, container, 1); - - var tabs = $('.' + that.tab_class, that.container); - tabs.tabs({ - select: function(event, ui) { - - // get the selected tab - var panel = $(ui.panel); - var name = panel.attr('name'); - var selected_tab = that.get_tab(name); - - // get the tab specified in the URL state - var state = that.get_state(); - var url_tab = that.get_active_tab(state); - - if (url_tab) { - // if they are the same, the selection is triggered by hash change - if (url_tab == selected_tab) { - // use the URL state to update internal state - return that.push_state(state); - - // if the selection is for the ancestor - } else if (that.is_ancestor(url_tab, selected_tab)) { - // let the tab be updated and don't change the state - return true; - } - } - - // selection is triggered by mouse click, update the URL state - return that.show_tab(name); - } - }); - }; - - that._create = function(tabs, container, depth) { - - var parent_name = container.attr('name'); - that.path[parent_name] = tabs[0].name; - - container.addClass(that.tab_class); - container.addClass('tabs'+depth); - - var ul = $('<ul/>').appendTo(container); - var created_count = 0; - - for (var i=0; i<tabs.length; i++) { - var tab = tabs[i]; - tab.container = container; - - var tab_id = that.root+'-'+tab.name; - - if (tab.entity) { - var entity = IPA.get_entity(tab.entity); - if (!entity){ - tabs.splice(i, 1); - i--; - continue; - } - tab.entity = entity; - - if (!tab.label) { - tab.label = entity.label; - } - } - - var tab_li = $('<li/>').append($('<a/>', { - href: '#'+tab_id, - title: tab.label, - html: tab.label - })); - - if (tab.hidden) { - tab_li.css('display', 'none'); - } - - tab.children_container = $('<div/>', { - id: tab_id, - name: tab.name - }); - - if (tab.children && tab.children.length) { - var kids = - that._create(tab.children, tab.children_container, depth+1); - /*If there are no child tabs, remove the container */ - if (kids === 0) { - tabs.splice(i, 1); - i -= 1; - continue; - } - } - created_count += 1; - tab_li.appendTo(ul); - tab.children_container.appendTo(container); - } - return created_count; - }; - - that.update = function() { - for (var i=1; i<=that.max_depth; i++) { - that.container.removeClass(that.tab_class+'-'+i); - that.content.removeClass(that.tab_class+'-'+i); - } - $('.entity', that.content).css('display', 'none'); - - var container = $('div[name='+that.root+']', that.container); - that._update(that.tabs, container, 1); - }; - - that._update = function(tabs, container, depth) { - - var parent_name = container.attr('name'); - var tab_name = that.get_state(parent_name); - if (!tab_name) tab_name = that.path[parent_name]; - that.path[parent_name] = tab_name; - - var index = 0; - while (index < tabs.length && tabs[index].name != tab_name) index++; - if (index >= tabs.length) index = 0; - - container.tabs('select', index); - - var tab = tabs[index]; - if (tab.depth !== undefined) { - depth += tab.depth; - } - - if (tab.children && tab.children.length) { - var next_depth = depth + 1; - that._update(tab.children, tab.children_container, next_depth); - - } else if (tab.entity) { - - that.container.addClass(that.tab_class+'-'+depth); - that.content.addClass(that.tab_class+'-'+depth); - - var entity_container = $('.entity[name="'+tab.entity.name+'"]', - that.content); - if (!entity_container.length) { - tab.content = $('<div/>', { - name: tab.entity.name, - title: tab.entity.label, - 'class': 'entity' - }).appendTo(that.content); - tab.entity.create(tab.content); - } - - entity_container.css('display', 'block'); - tab.entity.display(tab.content); - } - }; - - // methods that should be invoked by subclasses - that.navigation_update = that.update; - - that.set_tabs(spec.tabs); - - return that; -}; - -return {}; -});
\ No newline at end of file diff --git a/install/ui/src/freeipa/webui.js b/install/ui/src/freeipa/webui.js deleted file mode 100644 index db1dab07..00000000 --- a/install/ui/src/freeipa/webui.js +++ /dev/null @@ -1,136 +0,0 @@ -/* Authors: - * Pavel Zuna <pzuna@redhat.com> - * Endi S. Dewata <edewata@redhat.com> - * - * Copyright (C) 2010 Red Hat - * see file 'COPYING' for use and warranty information - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -define(['./ipa'], function(IPA) { - -/* tabs definition for IPA webUI */ - -IPA.admin_navigation = function(spec) { - - spec = spec || {}; - - spec.name = 'admin'; - - spec.tabs = [ - {name: 'identity', label: IPA.messages.tabs.identity, children: [ - {entity: 'user'}, - {entity: 'group'}, - {entity: 'host'}, - {entity: 'hostgroup'}, - {entity: 'netgroup'}, - {entity: 'service'}, - {name:'dns', label: IPA.messages.tabs.dns, children:[ - {entity: 'dnszone'}, - {entity: 'dnsconfig'}, - {entity: 'dnsrecord', hidden:true} - ] - }, - {entity: 'cert', label: IPA.messages.tabs.cert }, - {entity: 'realmdomains'} - ]}, - {name: 'policy', label: IPA.messages.tabs.policy, children: [ - {name: 'hbac', label: IPA.messages.tabs.hbac, children: [ - {entity: 'hbacrule'}, - {entity: 'hbacsvc'}, - {entity: 'hbacsvcgroup'}, - {entity: 'hbactest'} - ]}, - {name: 'sudo', label: IPA.messages.tabs.sudo, children: [ - {entity: 'sudorule'}, - {entity: 'sudocmd'}, - {entity: 'sudocmdgroup'} - ]}, - {name:'automount', - label: IPA.messages.tabs.automount, - children:[ - {entity: 'automountlocation', hidden:true, depth: -1}, - {entity: 'automountmap', hidden: true, depth: -1}, - {entity: 'automountkey', hidden: true, depth: -1}]}, - {entity: 'pwpolicy'}, - {entity: 'krbtpolicy'}, - {entity: 'selinuxusermap'}, - {name: 'automember', label: IPA.messages.tabs.automember, - children: [ - { name: 'amgroup', entity: 'automember', - facet: 'searchgroup', label: IPA.messages.objects.automember.usergrouprules}, - { name: 'amhostgroup', entity: 'automember', - facet: 'searchhostgroup', label: IPA.messages.objects.automember.hostgrouprules} - ]} - ]}, - {name: 'ipaserver', label: IPA.messages.tabs.ipaserver, children: [ - {name: 'rolebased', label: IPA.messages.tabs.role, children: [ - {entity: 'role'}, - {entity: 'privilege'}, - {entity: 'permission'} - ]}, - {entity: 'selfservice'}, - {entity: 'delegation'}, - {entity: 'idrange'}, - { - name: 'trusts', label: IPA.messages.tabs.trust, children:[ - {entity: 'trust'}, - {entity: 'trustconfig'} - ] - }, - {entity: 'config'} - ]}]; - - var that = IPA.navigation(spec); - - return that; -}; - -IPA.self_serv_navigation = function(spec) { - - spec = spec || {}; - - spec.name = 'self-service'; - - spec.tabs = [ - {name: 'identity', label: IPA.messages.tabs.identity, children: [ - {entity: 'user'} - ]}]; - - var that = IPA.navigation(spec); - - that.update = function() { - var pkey = that.get_state('user-pkey'); - var facet = that.get_state('user-facet'); - - if (pkey && facet) { - that.navigation_update(); - - } else { - var state = { - 'navigation': 'identity', - 'identity': 'user', - 'user-pkey': pkey || IPA.whoami_pkey, - 'user-facet': facet || 'details' - }; - that.push_state(state); - } - }; - - return that; -}; - -return {}; -}); diff --git a/install/ui/src/libs/Makefile.am b/install/ui/src/libs/Makefile.am index 20d90854..807b9d8d 100644 --- a/install/ui/src/libs/Makefile.am +++ b/install/ui/src/libs/Makefile.am @@ -3,7 +3,6 @@ NULL = appdir = $(IPA_DATA_DIR)/ui/js/libs app_DATA = \ browser.js \ - jquery.ba-bbq.js \ jquery.js \ jquery.ordered-map.js \ jquery-ui.js \ diff --git a/install/ui/src/libs/jquery.ba-bbq.js b/install/ui/src/libs/jquery.ba-bbq.js deleted file mode 100644 index bcbf2483..00000000 --- a/install/ui/src/libs/jquery.ba-bbq.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 - * http://benalman.com/projects/jquery-bbq-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this); -/* - * jQuery hashchange event - v1.2 - 2/11/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
\ No newline at end of file |