User validation in Google Sheets - validation

I've been working on a project in Google Sheets for my team! The thing is: I've a sheet inside it and I want only me and 2 other people (they can edit the sheet) to see it, so that anyone entering with a "View-Only" permission would not see it!
EDIT: Let me explain a little better: I have a project which includes the specific sheet (let me call it Sheet_1) that I want to keep secret.
The project consists in a database for financial status of my team, so it is mandatory that ALL team members may see it. But there's the catch: I don't want EVERYONE in the team to see Sheet_1, I want only a specific group (call it Admins) to be able to see it. I cannot simply hide Sheet_1 because every time the Admins edit it in any way, it becomes visible for everyone again.
So let me be clear over who's involved in this
Admins: People (including me) who can see everything and change everything in the project
Non-Admins: People who must view the project in a "View-Only" Mode, and may not see Sheet_1
I've searched for a little bit and this is the code that I have:
function onOpen() {
var adminUsers = ['admin#email.com'];
if (adminUsers.indexOf(Session.getEffectiveUser().getEmail()) >= 0) {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetname').showSheet()
}
else {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetname').hideSheet()
}
}
But this code doesn't work! It doesn't hide the sheet when the non-Admins view my project, and it also asks for a Google login each time someone opens the project!
So, the code that I'm looking for is something like this:
function onOpen(){
var admin = [authorized emails that I inputted manually]
var email = getCurrentUserEmail()
if(email is in admin){
show specific sheet
}
else{
don't show specific sheet
}
EDIT: I see now that maybe what I'm asking is too complicated, so I'd be glad if anyone could give me suggestions!
Can anyone help me with this? I'll give more detalis if necessary!
Thanks!

Related

Some kind of Dashboard in FullCalendar

yeah what more to describe
I have no clue how to do that. Setup fullcalendar, fetsch data and enter data works fine.
The last thing I needit is a Dashboard under the Calendar witch get the selected week that visible in the Calendar (would be great when act also with the prev and next Arrow Buttons form the Calendar), and get the summary Events from selected Week witch holds already the durration of the single Events.
Do you know what a mean? and shy asking would you be ma hero?
Maby i found the Solution
main.js
weekNumberClassNames: function(view, element){ $('#card-title').html(calWeek); }
Let the magic happen by every view change, it also the WeekNumber change
A big part is solved.

Robotium : Getting number of items in spinner?

I'm a QA, and I'm new to android automation as such, and I am having problem in automating the spinner / Dropdown related activities in my app. I am using Robotium 4.1 for my automation.
The Spinner in my app is implemented using actionbarsherlock. The Hierarchyviewer shows it as Popupwindow:SOME-RANDOM-ID. It looks like the implementation is internal to actionbarsherlock. After talking to the dev he tells me that it's a "non-visible" element. I don't understand what that means, because I can see the element.
Also, I can't find the methods mentioned in some of the other questions here.
I suppose the right way is to use solo.getViews(), and solo.getCurrentViews etc. but I don't know how to use the parameters in there, so whatever I tried didn't work.
Can someone guide me with a detailed example? (including how to give the parameters to getViews etc will be much appreciated.)
How to get number of items:
mSpinner.getAdapter().getCount();
How to click on specified item on spinner:
solo.pressSpinnerItem(indexOfSpinner, indexOfItem);
How to get current spinners:
ArrayList<Spinner> currentSpinners = solo.getCurrentViews(Spinner.class);
How to get spinner with specified index:
Spinner spinner = getView(Spinner.class, index);

k2 articles in Joomla become unpublished if the author makes a minor change from the Frontend

The "Authors" group doesn't have any publish rights. This is ok. So an Editor/Administrator does an initial approve of any article.
Problem comes if the Author decides to edit the already published article. When he hit "save" from the frontend, the item immediately becomes unpublished.(Because authors group doesn't have the right to publish items). So, this a huge problem at least for my case.
I want articles to remain published after the initial approval of the admin, even if the author makes adjustments. Any idea how to do something like this?
This logic comes as the default way of doing things in the Joomla Core.
You may want to consider switching from K2 to something like else like EasyBlog then... Or just don't use K2. It seems like the default for K2 is to follow a workflow that conflicts with yours.
Otherwise you can modify K2 to suit your needs... I really don't recommend modifying extensions because then you can no longer make updates to them unless you plan to make the modifications every time you update (which is a pain).
You problem resides in the administrator/components/com_k2/models/item.php The following lines are form version 2.6.1 line 785.
if ($front)
{
if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published)
{
$row->published = 0;
$mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
}
}
If I understand you correctly you want something more like:
if ($front)
{
$row->published = 1;
if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published && $isNew)
{
$row->published = 0;
$mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
}
}
If I understand their model right by adding a check for $isNew to the if statement it will only apply published = 0 to new entries. Which, if I understand you, are the only ones you want to affect. This way if if the article already exists and it's published it will always stay published unless an admin changes it to unpublished.
I'm not sure if this will work the way I expect so let me know.
You should either allow Authors to edit any item or disable option for editing articles for authors.
Go to your joomla administration, go to k2 menu and in User Groups tabs create a group called editors and give it access to Publish item, then go back to Users tab and put those users that you want to make them editor in editors group.
Make sure your editor group users have access to Front-end item editing and Edit any item.
Your problem is because your editors have Edit any item access but they don't access to Publish item.
The permission that you want to set is actually in the k2 user group settings. Look for Allow editing of already published items and set it to yes.
At least this is true for k2 v. 2.6.7, although I don't think any of the permission settings have changed since v.2.6.0 or earlier.

Making a field unavailable to a user with javascript in MS CRM 4

I am trying to disable a field, i.e. grey it out and not allow the user to select it. To achieve this effect I am currently calling
crmForm.all.new_attribute1.disabled = true;
crmForm.all.new_attribute2.Disabled = true;
The Disable, with a capital D, makes the field grayed out but the user can still put the cursor in that field or tab to it.
The disable, with a little d, makes the field unavailable to the cursor and via tab, but gives no visual indication that it can't be interacted with.
Is there a better way to do this, one call that will achieve similar results or am I stuck having both there?
Using "Disabled" property should work.
You can try putting this code in OnLoad event of Account entity (don't forget to enable Event and Publich entity!):
crmForm.all.accountnumber.Disabled = true;
And "Account Number" will be blocked and greyed as seen in this picture:
(source: vidmar.net)
You are talking about readOnly and disabled.
A great article was posted http://customerfx.com/pages/crmdeveloper/2006/03/06/readonly-and-disabled-fields.aspx ... maybe this could help.

Save drop-down history in a Firefox Toolbar

I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile.
Is there any tutorial on how to sort this out?
Since it's taking quite a bit to get an answer I went and investigate it myself.
Here is what I've got now. Not all is clear to me but it works.
Let's assume you have a <textbox> like this, on your .xul:
<textbox id="search_with_history" />
You now have to add some other attributes to enable history.
<textbox id="search_with_history" type="autocomplete"
autocompletesearch="form-history"
autocompletesearchparam="Search-History-Name"
ontextentered="Search_Change(param);"
enablehistory="true"
/>
This gives you the minimum to enable a history on that textbox.
For some reason, and here is where my ignorance shows, the onTextEntered event function has to have the param to it called "param". I tried "event" and it didn't work.
But that alone will not do work by itself. One has to add some Javascript to help with the job.
// This is the interface to store the history
const HistoryObject = Components.classes["#mozilla.org/satchel/form-history;1"]
.getService(
Components.interfaces.nsIFormHistory2 || Components.interfaces.nsIFormHistory
);
// The above line was broken into 4 for clearness.
// If you encounter problems please use only one line.
// This function is the one called upon the event of pressing <enter>
// on the text box
function Search_Change(event) {
var terms = document.getElementById('search_with_history').value;
HistoryObject.addEntry('Search-History-Name', terms);
}
This is the absolute minimum to get a history going on.
Gustavo,
I wanted to do the same thing - I found an answer here on the Mozilla support forums. (Edit: I wanted to save my search history out of interest, not because I wanted to learn how the Firefox toolbars work, as you said.)
Basically, that data is stored in a sqlite database file called formhistory.sqlite (in your Firefox profile directory). You can use the Firefox extension SQLite Manager to retrieve and export the data: https://addons.mozilla.org/firefox/addon/5817
You can export it as a CSV (comma- separated values) file and open it with Excel or other software.
This has the added benefit of also saving the history of data you've entered into other forms/fields on sites, such as the Search field on Google, etc, if this data is of interest to you.
Gustavo's solution is good, but document.getElemenById('search_with_history').value; is missing a 't' in getElementById

Resources