Salesforce already disables the buttons on standard page layouts when a Save is selected. I took a look at their main.js javascript file, and it looks like the following function is what is called when a Save is clicked:
DetailPage.prototype.save = function () {
if (!this.saving && this.editMode) {
this.saving = !0;
for (var a = 0; a < this.editButtons.length; a++){
this.editButtons[a].className = "btnDisabled";
this.editButtons[a].value = LC.getLabel("Buttons", "saving");
}
this.inlineEditData.save();
}
};
So, it looks like simply setting the buttons class to "btnDisabled" should be exactly what you want to do. Salesforce changes the label of the button as well using a different Javascript file that loads separately (en_US.js in this case). That javascript looks like:
LC.labels = {
...
'Buttons': {
'cancel': 'Cancel',
'close': 'Close',
'confirm': 'Confirm',
'create_new': 'Create New {0}',
'customize': 'Customize',
'del': 'Delete',
'delete': 'Delete',
'dont_save': 'Don\'t Save',
'edit': 'Edit',
'go': 'Go!',
'help': 'Help',
'hide': 'Hide Details',
'ins': 'Insert',
'new': 'New',
'no': 'No',
'ok': 'OK',
'page_help': 'Help for this Page',
'quick_save': 'Quick Save',
'refreshData': 'Refresh',
'remove': 'Remove',
'save': 'Save',
'saveAs': 'Save As',
'save_and_close': 'Save & Close',
'save_and_new': 'Save & New',
'saving': 'Saving...',
'search': 'Search',
'send': 'Send',
'show': 'Show Details',
'submit': 'Submit',
'undo': 'Undo',
'yes': 'Yes'
},
...
}
This utilizes the following CSS from common.css:
.btnDisabled {
font-family:'Verdana','Geneva',sans-serif;
background-image:url("/img/bgButtonDisabled.gif");
background-repeat:repeat-x;
background-position:left top;
border-right:1px solid #999999;
border-bottom:1px solid #999999;
border-top:1px solid #CCCCCC;
border-left:1px solid #CCCCCC;
font-size:80%;
color:#C1C1C1;
padding:0 3px 1px 3px;
cursor:default;
font-weight: bold
}
You may be able to do something along the lines of:
onClick="this.className='btnDisabled';this.value=LC.getLabel('Buttons"', 'saving');"
That should properly add internationalization too I believe. Now, this is all theory and all of these Javascript files may not load on non-standard pages, but either way you should be able to adapt this. Unfortunately, this still doesn't solve your issue on disabling the actual click. Now you can do this a few ways, adding a Javascript file that you can then use to save a variable. You could also just add a hidden field to store it as well:
<input type="hidden" value="true" id="firstButtonClick"/>
This would be my approach. Using all of this (theoretically), you should be able to use:
<apex:commandButton action="{!save}" onclick="this.className='btnDisabled';this.value='LC.getLabel('Buttons', 'saving');if(document.getElementById('firstButtonClick').value == 'true'){document.getElementById('firstButtonClick').value='false';return true;}else{return false;}"/>
<input type="hidden" value="true" id="firstButtonClick"/>
This may or may not be the best solution (or even a working once since I didn't test it all out fully), but this hopefully puts you in the right direction.