PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.7.31.4
Pods – Custom Content Types and Fields v2.7.31.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / components / Roles / ui / edit.php
pods / components / Roles / ui Last commit date
add.php 6 days ago edit.php 6 days ago
edit.php
198 lines
1 <div class="wrap pods-admin">
2 <script>
3 var PODS_URL = '<?php echo esc_js( PODS_URL ); ?>';
4 </script>
5 <div id="icon-pods" class="icon32"><br /></div>
6
7 <form action="" method="post" class="pods-submittable pods-form">
8 <div class="pods-submittable-fields">
9 <?php echo PodsForm::field( 'action', 'pods_admin_components', 'hidden' ); ?>
10 <?php echo PodsForm::field( 'component', $component, 'hidden' ); ?>
11 <?php echo PodsForm::field( 'method', $method, 'hidden' ); ?>
12 <?php echo PodsForm::field( 'id', $id, 'hidden' ); ?>
13 <?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?>
14
15 <h2 class="italicized"><?php _e( 'Roles &amp; Capabilities: Edit Role', 'pods' ); ?></h2>
16
17 <?php
18 if ( isset( $_GET['do'] ) ) {
19 $action = __( 'saved', 'pods' );
20
21 if ( 'create' == pods_var( 'do', 'get', 'save' ) ) {
22 $action = __( 'created', 'pods' );
23 }
24
25 $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
26
27 echo $obj->message( $message );
28 }
29 ?>
30
31 <p><?php _e( 'Choose below which Capabilities you would like this existing user role to have.', 'pods' ); ?></p>
32
33 <div id="poststuff" class="poststuff">
34 <div id="post-body" class="metabox-holder columns-2">
35
36 <div id="postbox-container-1" class="postbox-container">
37 <div id="side-sortables" class="meta-box-sortables ui-sortable">
38 <!-- BEGIN PUBLISH DIV -->
39 <div id="submitdiv" class="postbox">
40 <div class="handlediv" title="Click to toggle"><br /></div>
41 <h3 class="hndle"><span><?php _e( 'Manage', 'pods' ); ?></span></h3>
42
43 <div class="inside">
44 <div class="submitbox" id="submitpost">
45 <div id="minor-publishing">
46 <div id="major-publishing-actions">
47 <div id="publishing-action">
48 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
49 <input type="submit" name="publish" id="publish" class="button-primary" value="<?php _e( 'Save', 'pods' ); ?>" accesskey="p" />
50 </div>
51 <!-- /#publishing-action -->
52
53 <div class="clear"></div>
54 </div>
55 <!-- /#major-publishing-actions -->
56 </div>
57 <!-- /#minor-publishing -->
58 </div>
59 <!-- /#submitpost -->
60 </div>
61 <!-- /.inside -->
62 </div>
63 <!-- /#submitdiv --><!-- END PUBLISH DIV --><!-- TODO: minor column fields -->
64 </div>
65 <!-- /#side-sortables -->
66 </div>
67 <!-- /#side-info-column -->
68
69 <div id="postbox-container-2" class="postbox-container">
70 <div id="post-body-content">
71 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
72 <div id="pods-meta-box" class="postbox" style="">
73 <div class="handlediv" title="Click to toggle"><br /></div>
74 <h3 class="hndle">
75 <span>
76 <?php _e( 'Assign the Capabilities for', 'pods' ); ?>
77 <strong><?php echo $role_label; ?></strong>
78 </span>
79 </h3>
80
81 <div class="inside pods-manage-field pods-dependency">
82 <div class="pods-field-option-group">
83 <p>
84 <a href="#toggle" class="button" id="toggle-all"><?php _e( 'Toggle All Capabilities on / off', 'pods' ); ?></a>
85 </p>
86
87 <div class="pods-pick-values pods-pick-checkbox pods-zebra">
88 <ul>
89 <?php
90 $zebra = false;
91
92 foreach ( $capabilities as $capability ) {
93 $checked = false;
94
95 if ( true === (boolean) pods_var( $capability, $role_capabilities, false ) ) {
96 $checked = true;
97 }
98
99 $class = ( $zebra ? 'even' : 'odd' );
100
101 $zebra = ( ! $zebra );
102 ?>
103 <li class="pods-zebra-<?php echo esc_attr( $class ); ?>" data-capability="<?php echo esc_attr( $capability ); ?>">
104 <?php echo PodsForm::field( 'capabilities[' . $capability . ']', pods_var_raw( 'capabilities[' . $capability . ']', 'post', $checked ), 'boolean', array( 'boolean_yes_label' => $capability ) ); ?>
105 </li>
106 <?php
107 }
108 ?>
109 </ul>
110 </div>
111 </div>
112
113 <div class="pods-field-option-group">
114 <p class="pods-field-option-group-label">
115 <?php
116 echo PodsForm::label( 'custom_capabilities[0]', __( 'Custom Capabilities', 'pods' ), __( 'These capabilities will automatically be created and assigned to this role', 'pods' ) );
117 ?>
118 </p>
119
120 <div class="pods-pick-values pods-pick-checkbox">
121 <ul id="custom-capabilities">
122 <li class="pods-repeater hidden">
123 <?php echo PodsForm::field( 'custom_capabilities[--1]', '', 'text' ); ?>
124 </li>
125 <li>
126 <?php echo PodsForm::field( 'custom_capabilities[0]', '', 'text' ); ?>
127 </li>
128 </ul>
129
130 <p>
131 <a href="#add-capability" id="add-capability" class="button"><?php _e( 'Add Another Custom Capability', 'pods' ); ?></a>
132 </p>
133 </div>
134 </div>
135 </div>
136 <!-- /.inside -->
137 </div>
138 <!-- /#pods-meta-box -->
139 </div>
140 <!-- /#normal-sortables -->
141
142 <!-- <div id="advanced-sortables" class="meta-box-sortables ui-sortable"></div> -->
143 <!-- /#advanced-sortables -->
144
145 </div>
146 <!-- /#post-body-content -->
147
148 <br class="clear" />
149 </div>
150 <!-- /#post-body -->
151
152 <br class="clear" />
153
154 </div>
155 </div>
156 <!-- /#poststuff -->
157 </div>
158 </form>
159 <!-- /#pods-record -->
160 </div>
161
162 <script type="text/javascript">
163 var pods_admin_submit_callback = function ( id ) {
164 id = parseInt( id );
165 document.location = 'admin.php?page=pods-component-<?php echo esc_js( $component ); ?>&action=edit&id=<?php echo esc_js( $id ); ?>&do=save';
166 };
167
168 jQuery( function ( $ ) {
169 $( document ).Pods( 'validate' );
170 $( document ).Pods( 'submit' );
171 $( document ).Pods( 'wizard' );
172 $( document ).Pods( 'dependency' );
173 $( document ).Pods( 'advanced' );
174 $( document ).Pods( 'confirm' );
175 $( document ).Pods( 'sluggable' );
176
177 var toggle_all = true;
178
179 $( '#toggle-all' ).on( 'click', function ( e ) {
180 e.preventDefault();
181
182 $( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', toggle_all );
183
184 toggle_all = (!toggle_all);
185 } );
186
187 $( '#add-capability' ).on( 'click', function ( e ) {
188 e.preventDefault();
189
190 var new_id = $( 'ul#custom-capabilities li' ).length;
191 var html = $( 'ul#custom-capabilities li.pods-repeater' ).html().replace( /\-\-1/g, new_id );
192
193 $( 'ul#custom-capabilities' ).append( '<li id="capability-' + new_id + '">' + html + '</li>' );
194 $( 'li#capability-' + new_id + ' input' ).focus();
195 } );
196 } );
197 </script>
198