| 1 | <$mt:setvar name="screen_type" value="dialog-screen dialog-grant-role"$> |
|---|
| 2 | <mt:setvarblock name="page_title"><mt:var name="dialog_title"></mt:setvarblock> |
|---|
| 3 | <mt:include name="dialog/header.tmpl"> |
|---|
| 4 | |
|---|
| 5 | <!-- |
|---|
| 6 | This dialog presents a list of roles for selection. The user may |
|---|
| 7 | select one and only one role. |
|---|
| 8 | |
|---|
| 9 | If the role selected was a system role, then there is nothing further |
|---|
| 10 | to do. |
|---|
| 11 | |
|---|
| 12 | Upon selecting a non-system role, the user clicks the "Next" button to |
|---|
| 13 | then select one or more weblogs. |
|---|
| 14 | |
|---|
| 15 | possible paths: |
|---|
| 16 | |
|---|
| 17 | creating a new user association |
|---|
| 18 | list of users -> list of roles -> list of weblogs |
|---|
| 19 | |
|---|
| 20 | creating a new group association |
|---|
| 21 | list of groups -> list of roles -> list of weblogs |
|---|
| 22 | |
|---|
| 23 | creating a new association for a particular user |
|---|
| 24 | list of roles -> list of weblogs |
|---|
| 25 | |
|---|
| 26 | creating a new association for a particular group |
|---|
| 27 | list of roles -> list of weblogs |
|---|
| 28 | |
|---|
| 29 | To facilitate this, I need to create divs for each "page" of the dialog |
|---|
| 30 | all but the first will be hidden. The "continue" button will toggle from |
|---|
| 31 | one page to the following page. |
|---|
| 32 | --> |
|---|
| 33 | |
|---|
| 34 | <script type="text/javascript" src="<mt:var name="static_uri">js/tc/client.js"></script> |
|---|
| 35 | <script type="text/javascript" src="<mt:var name="static_uri">js/tc/json.js"></script> |
|---|
| 36 | <script type="text/javascript" src="<mt:var name="static_uri">js/dialog.js"></script> |
|---|
| 37 | |
|---|
| 38 | <script type="text/javascript"> |
|---|
| 39 | /* <![CDATA[ */ |
|---|
| 40 | var dialog; |
|---|
| 41 | var panels; |
|---|
| 42 | function dialog_closed(ok) { |
|---|
| 43 | if (ok) { |
|---|
| 44 | // fill out form and submit to create the association |
|---|
| 45 | var frm = document['grant']; |
|---|
| 46 | for (var i = 0; i < dialog.panels.length; i++) { |
|---|
| 47 | var panel = dialog.panels[i]; |
|---|
| 48 | var fld = frm.elements[panel.name]; |
|---|
| 49 | if (!fld) { |
|---|
| 50 | alert("can't find field for " + panel.name); |
|---|
| 51 | continue; |
|---|
| 52 | } |
|---|
| 53 | fld.value = panel.selectionList.items().join(","); |
|---|
| 54 | } |
|---|
| 55 | // commit! |
|---|
| 56 | frm.submit(); |
|---|
| 57 | } else { |
|---|
| 58 | closeDialog(); |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | function init() { |
|---|
| 63 | dialog = new Dialog.MultiPanel("assoc"); |
|---|
| 64 | panels = []; |
|---|
| 65 | var panel;<mt:loop name="panel_loop"> |
|---|
| 66 | panel = new ListingPanel("<mt:var name="panel_type">"); |
|---|
| 67 | panel.pager.setState(<mt:var name="pager_json">); |
|---|
| 68 | panels[panels.length] = panel;</mt:loop> |
|---|
| 69 | dialog.setPanels(panels); |
|---|
| 70 | dialog.open({}, dialog_closed); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | TC.attachLoadEvent(init); |
|---|
| 74 | /* ]]> */ |
|---|
| 75 | </script> |
|---|
| 76 | |
|---|
| 77 | <form name="grant" id="grant" method="post" target="_top" action="<mt:var name="script_url">"> |
|---|
| 78 | <input type="hidden" name="__mode" value="grant_role" /> |
|---|
| 79 | <input type="hidden" name="magic_token" value="<mt:var name="magic_token" escape="html">" /> |
|---|
| 80 | <input type="hidden" name="return_args" value="<mt:var name="return_args" escape="html">" /> |
|---|
| 81 | <mt:if name="blog_id"><input type="hidden" name="blog_id" value="<mt:var name="blog_id">" /> |
|---|
| 82 | </mt:if><mt:if name="edit_author_id"><input type="hidden" name="author_id" value="<mt:var name="edit_author_id">" /> |
|---|
| 83 | </mt:if><mt:if name="group_id"><input type="hidden" name="group_id" value="<mt:var name="group_id">" /> |
|---|
| 84 | </mt:if><mt:if name="role_id"><input type="hidden" name="role_id" value="<mt:var name="role_id">" /> |
|---|
| 85 | </mt:if><mt:loop name="panel_loop"> |
|---|
| 86 | <input type="hidden" name="<mt:var name="panel_type">" value="" /></mt:loop> |
|---|
| 87 | </form> |
|---|
| 88 | |
|---|
| 89 | <mt:if name="missing_data"> |
|---|
| 90 | <mt:if name="missing_role"> |
|---|
| 91 | <mtapp:statusmsg |
|---|
| 92 | id="generic-info" |
|---|
| 93 | class="info"> |
|---|
| 94 | <__trans phrase="No roles exist in this installation. [_1]Create a role</a>" params="<a href='javascript:void(0)' onclick='closeDialog("<mt:var name="script_url">?__mode=edit_role");'>"> |
|---|
| 95 | </mtapp:statusmsg> |
|---|
| 96 | </mt:if> |
|---|
| 97 | <mt:if name="missing_group"> |
|---|
| 98 | <mtapp:statusmsg |
|---|
| 99 | id="generic-info" |
|---|
| 100 | class="info"> |
|---|
| 101 | <__trans phrase="No groups exist in this installation. [_1]Create a group</a>" params="<a href='javascript:void(0)' onclick='closeDialog("<mt:var name="script_url">?__mode=view&_type=group");'>"> |
|---|
| 102 | </mtapp:statusmsg> |
|---|
| 103 | </mt:if> |
|---|
| 104 | <mt:if name="missing_author"> |
|---|
| 105 | <mtapp:statusmsg |
|---|
| 106 | id="generic-info" |
|---|
| 107 | class="info"> |
|---|
| 108 | <__trans phrase="No users exist in this installation. [_1]Create a user</a>" params="<a href='javascript:void(0)' onclick='closeDialog("<mt:var name="script_url">?__mode=view&_type=author");'>"> |
|---|
| 109 | </mtapp:statusmsg> |
|---|
| 110 | </mt:if> |
|---|
| 111 | <mt:if name="missing_blog"> |
|---|
| 112 | <mtapp:statusmsg |
|---|
| 113 | id="generic-info" |
|---|
| 114 | class="info"> |
|---|
| 115 | <__trans phrase="No blogs exist in this installation. [_1]Create a blog</a>" params="<a href='javascript:void(0)' onclick='closeDialog("<mt:var name="script_url">?__mode=view&_type=blog");'>"> |
|---|
| 116 | </mtapp:statusmsg> |
|---|
| 117 | </mt:if> |
|---|
| 118 | <div class="actions-bar"> |
|---|
| 119 | <div class="actions-bar-inner pkg actions"> |
|---|
| 120 | <form onsubmit="return false" onclick="window.focus();"> |
|---|
| 121 | <button |
|---|
| 122 | type="submit" |
|---|
| 123 | accesskey="x" |
|---|
| 124 | class="cancel primary-button" |
|---|
| 125 | title="<__trans phrase="Close (x)">" |
|---|
| 126 | ><__trans phrase="Close"></button> |
|---|
| 127 | </form> |
|---|
| 128 | </div> |
|---|
| 129 | </div> |
|---|
| 130 | <mt:else> |
|---|
| 131 | <mt:loop name="panel_loop"> |
|---|
| 132 | <mt:include name="include/listing_panel.tmpl"> |
|---|
| 133 | </mt:loop> |
|---|
| 134 | </mt:if> |
|---|
| 135 | |
|---|
| 136 | <mt:include name="dialog/footer.tmpl"> |
|---|