diff --git a/trunk/application/ui.linkswidget.class.inc.php b/trunk/application/ui.linkswidget.class.inc.php index 929403adf..e2e5aa72d 100644 --- a/trunk/application/ui.linkswidget.class.inc.php +++ b/trunk/application/ui.linkswidget.class.inc.php @@ -75,14 +75,15 @@ class UILinksWidget $sHTMLValue .= "\n"; $sHTMLValue .= $this->GetObjectPickerDialog($oPage, $sTargetClass, 'oLinkWidget'.$this->m_iInputId.'.OnOk'); $sHTMLValue .= $this->GetLinkObjectDialog($oPage, $this->m_iInputId); - $sHTMLValue .= "m_iInputId}\" size=\"35\" name=\"\" value=\"\" title=\"Type the first 3 characters\" />"; - $sHTMLValue .= "m_iInputId}.AddObject();\"/>"; + $sHTMLValue .= "m_iInputId}\" size=\"35\" name=\"\" value=\"\" title=\"Type the first 3 characters\"/>"; + $sHTMLValue .= "m_iInputId}\" value=\" Add... \" class=\"action\" onClick=\"oLinkWidget{$this->m_iInputId}.AddObject();\"/>"; $sHTMLValue .= " m_iInputId', '$sExtKeyToRemote');\"/>"; // another hidden input to store & pass the object's Id - $sHTMLValue .= "m_iInputId}\"/>\n"; + $sHTMLValue .= "m_iInputId}\" onChange=\"EnableAddButton('{$this->m_iInputId}');\"/>\n"; $sHTMLValue .= "m_iInputId}\" name=\"attr_{$this->m_sAttCode}{$this->m_sNameSuffix}\" value=\"\"/>\n"; $oPage->add_ready_script("\$('#{$this->m_iInputId}').val('$sJSON');\noLinkWidget{$this->m_iInputId}.Init();\n\$('#ac_{$this->m_iInputId}').autocomplete('./ajax.render.php', { minChars:3, onItemSelect:selectItem, onFindValue:findValue, formatItem:formatItem, autoFill:true, keyHolder:'#id_ac_{$this->m_iInputId}', extraParams:{operation:'ui.linkswidget', sclass:'{$this->m_sClass}', attCode:'{$this->m_sAttCode}', max:30}});"); - $oPage->add_ready_script("\$('#ac_{$this->m_iInputId}').result( function(event, data, formatted) { if (data) { $('#id_ac_{$this->m_iInputId}').val(data[1]); } } );"); + $oPage->add_ready_script("\$('#ac_add_{$this->m_iInputId}').attr('disabled', 'disabled');"); + $oPage->add_ready_script("\$('#ac_{$this->m_iInputId}').result( function(event, data, formatted) { if (data) { $('#id_ac_{$this->m_iInputId}').val(data[1]); $('#ac_add_{$this->m_iInputId}').attr('disabled', ''); } else { $('#ac_add_{$this->m_iInputId}').attr('disabled', 'disabled'); } } );"); } else { @@ -221,6 +222,7 @@ class UILinksWidget { $sHTML = <<< EOF
+
@@ -248,6 +250,7 @@ class UILinksWidget
+
EOF; $oPage->add_ready_script("$('#ManageObjectsDlg_$this->m_iInputId').jqm({overlay:70, modal:true, toTop:true});"); // jqModal Window //$oPage->add_ready_script("UpdateObjectList('$sClass');"); @@ -265,6 +268,7 @@ EOF; $sExtKeyToRemote = $oAttDef->GetExtKeyToRemote(); $sHTML = "
\n"; + $sHTML .= "
\n"; $sHTML .= "

$sLinkedClass attributes

\n"; $sHTML .= "
\n"; $index = 0; @@ -306,9 +310,10 @@ EOF; } } $sHTML .= $oPage->GetDetails($aDetails); - $sHTML .= "     \n"; + $sHTML .= "     \n"; $sHTML .= "
\n"; $sHTML .= "
\n"; + $sHTML .= "
\n"; $oPage->add_ready_script("$('#LinkDlg_$sId').jqm({overlay:70, modal:true, toTop:true});"); // jqModal Window //$oPage->add_ready_script("UpdateObjectList('$sClass');"); return $sHTML; diff --git a/trunk/css/jqModal.css b/trunk/css/jqModal.css index db45b7039..288981f2a 100644 --- a/trunk/css/jqModal.css +++ b/trunk/css/jqModal.css @@ -11,11 +11,12 @@ display: none; position: fixed; - top: 10%; - left: 20%; + top: 25px; + left: 25px; - margin-left: -100px; - width: 800px; + nomargin-left: 25px; + nomargin-right: 25px; + nowidth: 800px; background-color: #FFF; color: #333; @@ -37,4 +38,4 @@ * removed.html .jqmWindow { position: absolute; top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'); -} \ No newline at end of file +} diff --git a/trunk/js/linkswidget.js b/trunk/js/linkswidget.js index 47f65fc3b..d7027f77e 100644 --- a/trunk/js/linkswidget.js +++ b/trunk/js/linkswidget.js @@ -74,12 +74,16 @@ function LinksWidget(id, sLinkedClass, sExtKeyToMe, sExtKeyToRemote, aAttributes this.aLinks.push(oLink); } this.Refresh(); + // Grey out the 'Add...' button + $('#ac_add_'+this.id).attr('disabled', 'disabled'); } this.OnLinkCancel = function() { // Restore the links to their previous value (just in case) this.aLinks = this.aPreviousLinks; + // Grey out the 'Add...' button + $('#ac_add_'+this.id).attr('disabled', 'disabled'); } this.RemoveLink = function(index) diff --git a/trunk/js/wizard.utils.js b/trunk/js/wizard.utils.js index 21cdd6e77..dc58f8b5f 100644 --- a/trunk/js/wizard.utils.js +++ b/trunk/js/wizard.utils.js @@ -24,22 +24,6 @@ function AddObject(sClass, sId, sExtKeyToRemote) // Display the additional dialog $('#LinkDlg_'+sId).jqmShow(); return; - - // TO BE REWRITTEN - var sRelatedObjectIds = new String($('#related_object_ids_'+sId).val()); - if (sRelatedObjectIds.length > 0) - { - aRelatedObjectIds = sRelatedObjectIds.split(' '); - } - else - { - aRelatedObjectIds = new Array(); - } - // To do: check if the ID is not already in the list... - aRelatedObjectIds[aRelatedObjectIds.length] = sCurrentObjectId; - // Update the form & reload the list - $('#related_object_ids').val(aRelatedObjectIds.join(' ')); - UpdateObjectList(sClass, sExtKeyToRemote); } function ManageObjects(sTitle, sClass, sId, sExtKeyToRemote) @@ -158,6 +142,5 @@ function GetObjectIds(sInputId, sExtKeyToRemote) } } return aLinkedIds; - } diff --git a/trunk/js/wizardhelper.js b/trunk/js/wizardhelper.js index 89377316b..57ff91761 100644 --- a/trunk/js/wizardhelper.js +++ b/trunk/js/wizardhelper.js @@ -104,7 +104,7 @@ function WizardHelper(sClass) { operation: 'wizard_helper' }, function(json_data){ //console.log('data received:', json_data); - oWizardHelper.FromJSON(json_data); + //oWizardHelper.FromJSON(json_data); oWizardHelper.UpdateFields(); //console.log(oWizardHelper); $('#wizStep'+ G_iCurrentStep).unblock( {fadeOut: 0} ); diff --git a/trunk/pages/ajax.render.php b/trunk/pages/ajax.render.php index b5e892a44..c43924d60 100644 --- a/trunk/pages/ajax.render.php +++ b/trunk/pages/ajax.render.php @@ -94,7 +94,7 @@ switch($operation) $oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue); } - $oPage->add($oWizardHelper->ToJSON()); + $oPage->add("\n"); break; case 'ajax':