Several smaller changes

- Fix to the proposed attribute edit that got broken in a previous
commit

- Fix to the org filters for non admin users

- Some changes to the documentation
pull/217/head
iglocska 2013-06-17 15:23:21 +02:00
parent 788a99f294
commit 77e028dd9c
6 changed files with 259 additions and 72 deletions

View File

@ -117,6 +117,10 @@ class EventsController extends AppController {
if (!$v) continue 2;
$this->paginate['conditions'][] = array('Event.date' . ' <' => $v);
break;
case 'org' :
if (!$v) continue 2;
$this->paginate['conditions'][] = array('Event.orgc' . ' =' => $v);
break;
default:
if (!$v) continue 2;
$this->paginate['conditions'][] = array('Event.' . substr($k, 6) . ' LIKE' => '%' . $v . '%');

View File

@ -1,5 +1,6 @@
<?php if(empty($this->passedArgs['searchinfo'])) $this->passedArgs['searchinfo'] = '';?>
<?php if(empty($this->passedArgs['searchorgc'])) $this->passedArgs['searchorgc'] = '';?>
<?php if(empty($this->passedArgs['searchorg'])) $this->passedArgs['searchorg'] = '';?>
<?php if(empty($this->passedArgs['searchDatefrom'])) $this->passedArgs['searchDatefrom'] = '';?>
<?php if(empty($this->passedArgs['searchDateuntil'])) $this->passedArgs['searchDateuntil'] = '';?>
<div class="events index">
@ -93,6 +94,14 @@
} else { ?>
<th class="filter"><?php echo $this->Paginator->sort('org'); ?>
<a onclick="toggleField('#searchorg')" class="icon-search"></a>
<span id="searchorg"><br/>
<?php
echo $this->Form->input('searchorg', array(
'value' => $this->passedArgs['searchorg'],
'label' => '',
'class' => 'input-mini'));
?>
</span>
</th>
<?php
}
@ -283,6 +292,7 @@ $(document).ready( function () {
// onload hide all buttons
$('#searchinfo').hide();
$('#searchorgc').hide();
$('#searchorg').hide();
$('#searchdate').hide();
$('#searchpublished').hide();

View File

@ -47,70 +47,70 @@ As an admin, you can set up new accounts for users, edit the profiles of users,
To add a new user, click on the New User button in the administration menu to the left and fill out the following fields in the view that is loaded:<br />
<img src="/img/doc/add_user.png" alt = "Add user" title = "Fill this form out to add a new user. Keep in mind that the drop-down menu titled Role controls the privileges the user will have."/>
<ul>
<li><em>Email:</em> The user's e-mail address, this will be used as his/her login name and as an address to send all the automatic e-mails and e-mails sent by contacting the user as the reporter of an event.<br /></li>
<li><em>Password:</em> A temporary password for the user that he/she should change after the first login. Make sure that it is at least 6 characters long, includes a digit or a special character and contains at least one upper-case and at least one lower-case character.<br /></li>
<li><em>Confirm Password:</em> This should be an exact copy of the Password field.<br /></li>
<li><em>Org:</em>The organisation of the user. Entering ADMIN into this field will give administrator privileges to the user. If you are an organisation admin, then this field will be unchangeable and be set to your own organisation.<br /></li>
<li><em>Roles:</em> A drop-down list allows you to choose a role-group that the user should belong to. Roles define the privileges of the user. To learn more about roles, <a href=#roles>click here</a>.<br /></li>
<li><em>Receive alerts when events are published:</em> This option will subscribe the new user to automatically generated e-mails whenever an event is published.<br /></li>
<li><em>Receive alerts from "contact reporter" requests:</em> This option will subscribe the new user to e-mails that are generated when another user tries to get in touch with an event's reporting organisation that matches that of the new user.<br /></li>
<li><em>Authkey:</em> This is assigned automatically and is the unique authentication key of the user (he/she will be able to reset this and receive a new key). It is used for exports and for connecting one server to another, but it requires the user to be assigned to a role that has auth permission enabled.<br /></li>
<li><em>NIDS Sid:</em> Nids ID, not yet implemented.<br /></li>
<li><em>Gpgkey:</em> The key used for encrypting e-mails sent through the system. <br /></li>
<li><b>Email:</b> The user's e-mail address, this will be used as his/her login name and as an address to send all the automatic e-mails and e-mails sent by contacting the user as the reporter of an event.<br /></li>
<li><b>Password:</b> A temporary password for the user that he/she should change after the first login. Make sure that it is at least 6 characters long, includes a digit or a special character and contains at least one upper-case and at least one lower-case character.<br /></li>
<li><b>Confirm Password:</b> This should be an exact copy of the Password field.<br /></li>
<li><b>Org:</b>The organisation of the user. Entering ADMIN into this field will give administrator privileges to the user. If you are an organisation admin, then this field will be unchangeable and be set to your own organisation.<br /></li>
<li><b>Roles:</b> A drop-down list allows you to choose a role-group that the user should belong to. Roles define the privileges of the user. To learn more about roles, <a href=#roles>click here</a>.<br /></li>
<li><b>Receive alerts when events are published:</b> This option will subscribe the new user to automatically generated e-mails whenever an event is published.<br /></li>
<li><b>Receive alerts from "contact reporter" requests:</b> This option will subscribe the new user to e-mails that are generated when another user tries to get in touch with an event's reporting organisation that matches that of the new user.<br /></li>
<li><b>Authkey:</b> This is assigned automatically and is the unique authentication key of the user (he/she will be able to reset this and receive a new key). It is used for exports and for connecting one server to another, but it requires the user to be assigned to a role that has auth permission enabled.<br /></li>
<li><b>NIDS Sid:</b> Nids ID, not yet implemented.<br /></li>
<li><b>Gpgkey:</b> The key used for encrypting e-mails sent through the system. <br /></li>
</ul>
<h3>Listing all users:</h3>
To list all current users of the system, just click on List Users under the administration menu to the left. A view will be loaded with a list of all users and the following columns of information:<br />
<img src="/img/doc/list_users.png" alt = "List users" title = "View, Edit or Delete a user using the action buttons to the right."/><br />
<ul>
<li><em>Id:</em> The user's automatically assigned ID number.<br /></li>
<li><em>Org:</em> The organisation that the user belongs to.<br /></li>
<li><em>Email:</em> The e-mail address (and login name) of the user.<br /></li>
<li><em>Autoalert:</em> Shows whether the user has subscribed to auto-alerts and is always receiving the mass-emails regarding newly published events that he/she is eligible for.<br /></li>
<li><em>ontactalert:</em> Shows whether the user has the subscription to contact reporter e-mails directed at his/her organisation turned on or off.<br /></li>
<li><em>Gpgkey:</em> Shows whether the user has entered a Gpgkey yet.<br /></li>
<li><em>Nids Sid:</em> Shows the currently assigned NIDS ID.<br /></li>
<li><em>Termsaccepted:</em> This flag indicates whether the user has accepted the terms of use or not.<br /></li>
<li><em>Newsread:</em> The last point in time when the user has looked at the news section of the system.<br /></li>
<li><em>Action Buttons:</em> Here you can view a detailed view of a user, edit the basic details of a user (same view as the one used for creating a new user, but all the fields come filled out by default) or remove a user completely. <br /></li>
<li><b>Id:</b> The user's automatically assigned ID number.<br /></li>
<li><b>Org:</b> The organisation that the user belongs to.<br /></li>
<li><b>Email:</b> The e-mail address (and login name) of the user.<br /></li>
<li><b>Autoalert:</b> Shows whether the user has subscribed to auto-alerts and is always receiving the mass-emails regarding newly published events that he/she is eligible for.<br /></li>
<li><b>ontactalert:</b> Shows whether the user has the subscription to contact reporter e-mails directed at his/her organisation turned on or off.<br /></li>
<li><b>Gpgkey:</b> Shows whether the user has entered a Gpgkey yet.<br /></li>
<li><b>Nids Sid:</b> Shows the currently assigned NIDS ID.<br /></li>
<li><b>Termsaccepted:</b> This flag indicates whether the user has accepted the terms of use or not.<br /></li>
<li><b>Newsread:</b> The last point in time when the user has looked at the news section of the system.<br /></li>
<li><b>Action Buttons:</b> Here you can view a detailed view of a user, edit the basic details of a user (same view as the one used for creating a new user, but all the fields come filled out by default) or remove a user completely. <br /></li>
</ul>
<h3>Editing a user:</h3>
To add a new user, click on the New User button in the administration menu to the left and fill out the following fields in the view that is loaded:<br />
<ul>
<li><em>Email:</em> The user's e-mail address, this will be used as his/her login name and as an address to send all the automatic e-mails and e-mails sent by contacting the user as the reporter of an event.<br /></li>
<li><em>Password:</em> It is possible to assign a new password manually for a user. For example, in case that he/she forgot the old one a new temporary one can be assigned. Make sure to check the "Change password" field if you do give out a temporary password, so that the user will be forced to change it after login.<br /></li>
<li><em>Confirm Password:</em> This should be an exact copy of the Password field.<br /></li>
<li><em>Org:</em>The organisation of the user. Entering ADMIN into this field will give administrator privileges to the user. If you are an organisation admin, then this field will be unchangeable and be set to your own organisation.<br /></li>
<li><em>Roles:</em> A drop-down list allows you to choose a role-group that the user should belong to. Roles define the privileges of the user. To learn more about roles, <a href=#roles>click here</a>.<br /></li>
<li><em>Receive alerts when events are published:</em> This option will subscribe the user to automatically generated e-mails whenever an event is published.<br /></li>
<li><em>Receive alerts from "contact reporter" requests:</em> This option will subscribe the user to e-mails that are generated when another user tries to get in touch with an event's reporting organisation that matches that of the user.<br /></li>
<li><em>Authkey:</em> It is possible to request a new authentication key for the user. <br /></li>
<li><em>NIDS Sid:</em> Nids ID, not yet implemented.<br /></li>
<li><em>Termsaccepted:</em> Indicates whether the user has accepted the terms of use already or not.<br /></li>
<li><em>Change Password:</em> Setting this flag will require the user to change password after the next login.<br /></li>
<li><em>Gpgkey:</em> The key used for encrypting e-mails sent through the system. <br /></li>
<li><b>Email:</b> The user's e-mail address, this will be used as his/her login name and as an address to send all the automatic e-mails and e-mails sent by contacting the user as the reporter of an event.<br /></li>
<li><b>Password:</b> It is possible to assign a new password manually for a user. For example, in case that he/she forgot the old one a new temporary one can be assigned. Make sure to check the "Change password" field if you do give out a temporary password, so that the user will be forced to change it after login.<br /></li>
<li><b>Confirm Password:</b> This should be an exact copy of the Password field.<br /></li>
<li><b>Org:</b>The organisation of the user. Entering ADMIN into this field will give administrator privileges to the user. If you are an organisation admin, then this field will be unchangeable and be set to your own organisation.<br /></li>
<li><b>Roles:</b> A drop-down list allows you to choose a role-group that the user should belong to. Roles define the privileges of the user. To learn more about roles, <a href=#roles>click here</a>.<br /></li>
<li><b>Receive alerts when events are published:</b> This option will subscribe the user to automatically generated e-mails whenever an event is published.<br /></li>
<li><b>Receive alerts from "contact reporter" requests:</b> This option will subscribe the user to e-mails that are generated when another user tries to get in touch with an event's reporting organisation that matches that of the user.<br /></li>
<li><b>Authkey:</b> It is possible to request a new authentication key for the user. <br /></li>
<li><b>NIDS Sid:</b> Nids ID, not yet implemented.<br /></li>
<li><b>Termsaccepted:</b> Indicates whether the user has accepted the terms of use already or not.<br /></li>
<li><b>Change Password:</b> Setting this flag will require the user to change password after the next login.<br /></li>
<li><b>Gpgkey:</b> The key used for encrypting e-mails sent through the system. <br /></li>
</ul>
<h3>Contacting a user:</h3>
Site admins can use the "Contact users" feature to send all or an individual user an e-mail. Users that have a PGP key set will receive their e-mails encrypted. When clicking this button on the left, you'll be presented with a form that allows you to specify the type of the e-mail, who it should reach and what the content is using the following options:<br />
<img src="/img/doc/contact.png" alt = "Contact" title = "Contact your users here."/><br />
<ul>
<li><em>Action:</em> This defines the type of the e-mail, which can be a custom message or a password reset. Password resets automatically include a new temporary password at the bottom of the message and will automatically change the user's password accordingly.<br /></li>
<li><em>Recipient:</em> The recipient toggle lets you contact all your users, a single user (which creates a second drop-down list with all the e-mail addresses of the users) and potential future users (which opens up a text field for the e-mail address and a text area field for a PGP public key).<br /></li>
<li><em>Subject:</em> In the case of a custom e-mail, you can enter a subject line here.<br /></li>
<li><em>Subject:</em> In the case of a custom e-mail, you can enter a subject line here.<br /></li>
<li><em>Custom message checkbox:</em> This is available for password resets, you can either write your own message (which will be appended with a temporary key and the signature), or let the system generate one automatically.<br /></li>
<li><b>Action:</b> This defines the type of the e-mail, which can be a custom message or a password reset. Password resets automatically include a new temporary password at the bottom of the message and will automatically change the user's password accordingly.<br /></li>
<li><b>Recipient:</b> The recipient toggle lets you contact all your users, a single user (which creates a second drop-down list with all the e-mail addresses of the users) and potential future users (which opens up a text field for the e-mail address and a text area field for a PGP public key).<br /></li>
<li><b>Subject:</b> In the case of a custom e-mail, you can enter a subject line here.<br /></li>
<li><b>Subject:</b> In the case of a custom e-mail, you can enter a subject line here.<br /></li>
<li><b>Custom message checkbox:</b> This is available for password resets, you can either write your own message (which will be appended with a temporary key and the signature), or let the system generate one automatically.<br /></li>
</ul>
Keep in mind that all e-mails sent through this system will, in addition to your own message, will be signed in the name of the instance's host organisation's support team, will include the e-mail address of the instance's support (if the contact field is set in the bootstrap file), and will include the instance's PGP signature for users that have a PGP key set (and thus are eligible for an encrypted e-mail).
<hr />
<h2><a id="roles"></a>Managing the roles</h2>
Privileges are assigned to users by assigning them to rule groups, which use one of four options determining what they can do with events and four additional privilege elevating settings. The four options for event manipulation are: Read Only, Manage My Own Events, Manage Organisation Events, Manage &amp; Publish Organisation Events. The extra privileges are admin, sync, authentication key usage and audit permission<br />
<em>Read Only:</em> This allows the user to browse events that his organisation has access to, but doesn't allow any changes to be made to the database. <br />
<em>Manage My Own Events:</em> The second option, gives its users rights to create, modify or delete their own events, but they cannot publish them. <br />
<em>Manage Organization Events:</em> allows users to create events or modify and delete events created by a member of their organisation. <br />
<em>Manage &amp; Publish Organisation Events:</em> This last setting, gives users the right to do all of the above and also to publish the events of their organisation.<br />
<em>Perm sync:</em> This setting allows the users of the role to be used as a synchronisation user. The authentication key of this user can be handed out to the administrator of a remote MISP instance to allow the synchronisation features to work.<br />
<em>Perm admin:</em> Gives the user administrator privileges, this setting is used for the organisation admins. <br />
<em>Perm audit:</em> Grants access to the logs. With the exception of site admins, only logs generated by the user's own org are visible. <br />
<em>Perm auth:</em> This setting enables the authentication key of the role's users to be used for rest requests. <br />
<b>Read Only:</b> This allows the user to browse events that his organisation has access to, but doesn't allow any changes to be made to the database. <br />
<b>Manage My Own Events:</b> The second option, gives its users rights to create, modify or delete their own events, but they cannot publish them. <br />
<b>Manage Organization Events:</b> allows users to create events or modify and delete events created by a member of their organisation. <br />
<b>Manage &amp; Publish Organisation Events:</b> This last setting, gives users the right to do all of the above and also to publish the events of their organisation.<br />
<b>Perm sync:</b> This setting allows the users of the role to be used as a synchronisation user. The authentication key of this user can be handed out to the administrator of a remote MISP instance to allow the synchronisation features to work.<br />
<b>Perm admin:</b> Gives the user administrator privileges, this setting is used for the organisation admins. <br />
<b>Perm audit:</b> Grants access to the logs. With the exception of site admins, only logs generated by the user's own org are visible. <br />
<b>Perm auth:</b> This setting enables the authentication key of the role's users to be used for rest requests. <br />
<h3>Creating roles:</h3>
When creating a new role, you will have to enter a name for the role to be created and set up the permissions (as described above) using the radio toggle and the four check-boxes.<br />
<h3>Listing roles:</h3>
@ -121,26 +121,26 @@ By clicking on the List Roles button, you can view a list of all the currently r
Users with audit permissions are able to browse or search the logs that MISP automatically appends each time certain actions are taken (actions that modify data or if a user logs in and out).<br />
Generally, the following actions are logged:<br />
<ul>
<li><em>User:</em> Creation, deletion, modification, Login / Logout<br /></li>
<li><em>Event:</em>Creation, deletion, modification, publishing<br /></li>
<li><em>Attribute:</em> Creation, deletion, modification<br /></li>
<li><em>Roles:</em> Creation, deletion, modification<br /></li>
<li><em>Blacklist:</em> Creation, deletion, modification<br /></li>
<li><em>Whitelist:</em> Creation, deletion, modification<br /></li>
<li><em>Regexp:</em> Creation, deletion, modification</li>
<li><b>User:</b> Creation, deletion, modification, Login / Logout<br /></li>
<li><b>Event:</b>Creation, deletion, modification, publishing<br /></li>
<li><b>Attribute:</b> Creation, deletion, modification<br /></li>
<li><b>Roles:</b> Creation, deletion, modification<br /></li>
<li><b>Blacklist:</b> Creation, deletion, modification<br /></li>
<li><b>Whitelist:</b> Creation, deletion, modification<br /></li>
<li><b>Regexp:</b> Creation, deletion, modification</li>
</ul>
<br />
<h3>Browsing the logs:</h3>
Listing all the log entries will show the following columns generated by the users of your organisation (or all organisations in the case of site admins):<br />
<img src="/img/doc/list_logs.png" alt = "List logs" title = "Here you can view a list of all logged actions."/><br />
<ul>
<li><em>Id:</em> The automatically assigned ID number of the entry.<br /></li>
<li><em>Email:</em> The e-mail address of the user whose actions triggered the entry.<br /></li>
<li><em>Org:</em> The organisation of the above mentioned user.<br /></li>
<li><em>Created:</em> The date and time when the entry originated.<br /></li>
<li><em>Action:</em> The action's type. This can include: login/logout for users, add, edit, delete for events, attributes, users and servers.<br /></li>
<li><em>Title:</em> The title of an event always includes the target type (Event, User, Attribute, Server), the target's ID and the target's name (for example: e-mail address for users, event description for events).<br /></li>
<li><em>Change:</em> This field is only filled out for entries with the action being add or edit. The changes are detailed in the following format:<br />
<li><b>Id:</b> The automatically assigned ID number of the entry.<br /></li>
<li><b>Email:</b> The e-mail address of the user whose actions triggered the entry.<br /></li>
<li><b>Org:</b> The organisation of the above mentioned user.<br /></li>
<li><b>Created:</b> The date and time when the entry originated.<br /></li>
<li><b>Action:</b> The action's type. This can include: login/logout for users, add, edit, delete for events, attributes, users and servers.<br /></li>
<li><b>Title:</b> The title of an event always includes the target type (Event, User, Attribute, Server), the target's ID and the target's name (for example: e-mail address for users, event description for events).<br /></li>
<li><b>Change:</b> This field is only filled out for entries with the action being add or edit. The changes are detailed in the following format:<br />
<i>variable (initial_value)</i> =&gt; <i>(new_value)</i>,...<br />
When the entry is about the creation of a new item (such as adding a new event) then the change will look like this for example:<br />
<i>org()</i> =&gt; <i>(ADMIN)</i>, <i>date()</i> =&gt; <i>(20012-10-19)</i>,... <br />
@ -149,11 +149,11 @@ Listing all the log entries will show the following columns generated by the use
<h3>Searching the Logs:</h3>
Another way to browse the logs is to search it by filtering the results according to the following fields (the search is a sub-string search, the sub-string has to be an exact match for the entry in the field that is being searched for):<br />
<ul>
<li><em>Email:</em> By searching by Email, it is possible to view the log entries of a single user.<br /></li>
<li><em>Org:</em> Searching for an organisation allows you to see all actions taken by any member of the organisation.<br /></li>
<li><em>Action:</em> With the help of this drop down menu, you can search for various types of actions taken (such as logins, deletions, etc).<br /></li>
<li><em>Title:</em> There are several ways in which to use this field, since the title fields contain several bits of information and the search searches for any substrings contained within the field, it is possible to just search for the ID number of a logged event, the username / server's name / event's name / attribute's name of the event target.<br /></li>
<li><em>Change:</em> With the help of this field, you can search for various specific changes or changes to certain variables (such as published will find all the log entries where an event has gotten published, ip-src will find all attributes where a source IP address has been entered / edited, etc).<br /></li>
<li><b>Email:</b> By searching by Email, it is possible to view the log entries of a single user.<br /></li>
<li><b>Org:</b> Searching for an organisation allows you to see all actions taken by any member of the organisation.<br /></li>
<li><b>Action:</b> With the help of this drop down menu, you can search for various types of actions taken (such as logins, deletions, etc).<br /></li>
<li><b>Title:</b> There are several ways in which to use this field, since the title fields contain several bits of information and the search searches for any substrings contained within the field, it is possible to just search for the ID number of a logged event, the username / server's name / event's name / attribute's name of the event target.<br /></li>
<li><b>Change:</b> With the help of this field, you can search for various specific changes or changes to certain variables (such as published will find all the log entries where an event has gotten published, ip-src will find all attributes where a source IP address has been entered / edited, etc).<br /></li>
</ul>
</div>

View File

@ -55,22 +55,22 @@
<h5>Sync Actions</h5>
<ul>
<li><em>List Servers:</em> Connect your MISP instance to other instances, or view and modify the currently established connections.</li>
<li><b>List Servers:</b> Connect your MISP instance to other instances, or view and modify the currently established connections.</li>
</ul>
<h5>Administration</h5>
<ul>
<li><em>New User:</em> Create an account for a new user for your organisation. Site administrators can create users for any organisation.</li>
<li><em>List Users:</em> View, modify or delete the currently registered users.</li>
<li><em>New Role:</em> Create a new role group for the users of this instance, controlling their privileges to create, modify, delete and to publish events and to access certain features such as the logs or automation.</li>
<li><em>List Roles:</em> List, modify or delete currently existing roles.</li>
<li><em>Contact Users:</em> You can use this view to send messages to your current or future users or send them a new temporary password.</li>
<li><b>New User:</b> Create an account for a new user for your organisation. Site administrators can create users for any organisation.</li>
<li><b>List Users:</b> View, modify or delete the currently registered users.</li>
<li><b>New Role:</b> Create a new role group for the users of this instance, controlling their privileges to create, modify, delete and to publish events and to access certain features such as the logs or automation.</li>
<li><b>List Roles:</b> List, modify or delete currently existing roles.</li>
<li><b>Contact Users:</b> You can use this view to send messages to your current or future users or send them a new temporary password.</li>
</ul>
<h5>Audit</h5>
<ul>
<li><em>List Logs:</em> View the logs of the instance.</li>
<li><em>Search Logs:</em> Search the logs by various attributes.</li>
<li><b>List Logs:</b> View the logs of the instance.</li>
<li><b>Search Logs:</b> Search the logs by various attributes.</li>
</ul>
<h3>The left bar</h3>
<p>This bar changes based on each page-group. The blue selection shows you what page you are on.</p>

View File

@ -0,0 +1,173 @@
<div class="shadowAttributes form">
<?php echo $this->Form->create('ShadowAttribute');?>
<fieldset>
<legend><?php echo __('Add ShadowAttribute'); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('category', array(
'empty' => '(choose one)',
'div' => 'input',
));
if (!$attachment) {
echo $this->Form->input('type', array(
'empty' => '(first choose category)'
));
}
?>
<div class="input clear"></div>
<?php
echo $this->Form->input('value', array(
'type' => 'textarea',
'error' => array('escape' => false),
'class' => 'input-xxlarge clear'
));
?>
<div class="input clear"></div>
<?php
echo $this->Form->input('batch_import', array(
'type' => 'checkbox',
));
echo $this->Form->input('to_ids', array(
'checked' => true,
'label' => 'IDS Signature?',
));
// link an onchange event to the form elements
$this->Js->get('#ShadowAttributeCategory')->event('change', 'formCategoryChanged("#ShadowAttributeCategory")');
$this->Js->get('#ShadowAttributeType')->event('change', 'showFormInfo("#ShadowAttributeType")');
?>
</fieldset>
<?php
echo $this->Form->button('Propose', array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
<div class="actions">
<ul class="nav nav-list">
<li><?php echo $this->Html->link('View Event', array('controller' => 'events', 'action' => 'view', $this->request->data['ShadowAttribute']['event_id'])); ?> </li>
<li class="active"><?php echo $this->Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $this->request->data['ShadowAttribute']['event_id']));?> </li>
<li><?php echo $this->Html->link('Propose Attachment', array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $this->request->data['ShadowAttribute']['event_id']));?> </li>
<li class="divider"></li>
<li><?php echo $this->Html->link('Contact reporter', array('controller' => 'events', 'action' => 'contact', $this->request->data['ShadowAttribute']['event_id'])); ?> </li>
<li><?php echo $this->Html->link('Download as XML', array('controller' => 'events', 'action' => 'xml', 'download', $this->request->data['ShadowAttribute']['event_id'])); ?></li>
<li><?php echo $this->Html->link('Download as IOC', array('controller' => 'events', 'action' => 'downloadOpenIOCEvent', $this->request->data['ShadowAttribute']['event_id'])); ?> </li>
<li class="divider"></li>
<li><?php echo $this->Html->link('List Events', array('controller' => 'events', 'action' => 'index')); ?></li>
<?php if ($isAclAdd): ?>
<li><?php echo $this->Html->link('Add Event', array('controller' => 'events', 'action' => 'add')); ?></li>
<?php endif; ?>
</ul>
</div>
<script type="text/javascript">
//
//Generate Category / Type filtering array
//
var category_type_mapping = new Array();
<?php
foreach ($categoryDefinitions as $category => $def) {
echo "category_type_mapping['" . addslashes($category) . "'] = {";
$first = true;
foreach ($def['types'] as $type) {
if ($first) $first = false;
else echo ', ';
echo "'" . addslashes($type) . "' : '" . addslashes($type) . "'";
}
echo "}; \n";
}
?>
function formCategoryChanged(id) {
showFormInfo(id); // display the tooltip
// fill in the types
var options = $('#ShadowAttributeType').prop('options');
$('option', $('#ShadowAttributeType')).remove();
$.each(category_type_mapping[$('#ShadowAttributeCategory').val()], function(val, text) {
options[options.length] = new Option(text, val);
});
// enable the form element
$('#ShadowAttributeType').prop('disabled', false);
}
$(document).ready(function() {
$("#ShadowAttributeType, #ShadowAttributeCategory, #ShadowAttribute").on('mouseleave', function(e) {
$('#'+e.currentTarget.id).popover('destroy');
});
$("#ShadowAttributeType, #ShadowAttributeCategory, #ShadowAttribute").on('mouseover', function(e) {
var $e = $(e.target);
if ($e.is('option')) {
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
trigger: 'manual',
placement: 'right',
content: formInfoValues[$e.val()],
}).popover('show');
}
});
$("input, label").on('mouseleave', function(e) {
$('#'+e.currentTarget.id).popover('destroy');
});
$("input, label").on('mouseover', function(e) {
var $e = $(e.target);
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
trigger: 'manual',
placement: 'right',
}).popover('show');
});
// workaround for browsers like IE and Chrome that do now have an onmouseover on the 'options' of a select.
// disadvangate is that user needs to click on the item to see the tooltip.
// no solutions exist, except to generate the select completely using html.
$("#ShadowAttributeType, #ShadowAttributeCategory, #ShadowAttribute").on('change', function(e) {
var $e = $(e.target);
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
trigger: 'manual',
placement: 'right',
content: formInfoValues[$e.val()],
}).popover('show');
});
});
//
//Generate tooltip information
//
var formInfoValues = new Array();
<?php
foreach ($typeDefinitions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
}
foreach ($categoryDefinitions as $category => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['" . addslashes($category) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
}
?>
function showFormInfo(id) {
idDiv = id+'Div';
// LATER use nice animations
//$(idDiv).hide('fast');
// change the content
var value = $(id).val(); // get the selected value
$(idDiv).html(formInfoValues[value]); // search in a lookup table
// show it again
$(idDiv).fadeIn('slow');
}
//hide the formInfo things
$('#ShadowAttributeTypeDiv').hide();
$('#ShadowAttributeCategoryDiv').hide();
// fix the select box based on what was selected
var type_value = $('#ShadowAttributeType').val();
formCategoryChanged("#ShadowAttributeCategory");
$('#ShadowAttributeType').val(type_value);
</script>
<?php echo $this->Js->writeBuffer(); // Write cached scripts

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB