macpalka
19-10-2006, 20:53
Mam taki problem z którym walczę już dość dlugo. A mianowicie chciałbym ażeby po dodaniu nowego wpisu przez klienta w sobi2 zostało przekierowane nie na stronę główną tylko na jakąś inną żebym mógł tam umieścić informację że strona została przesłana do administratora. Zauważyłem że może być za to odpowiedzialny plik form.class.php i fragment kodu
if($this->item)
$href = "index.php?option=com_sobi2&sobi2Task=checkin&sobi2 Id={$this->item->id}&Itemid={$config->sobi2Itemid}";
else
$href = "index.php?option=com_sobi2&Itemid={$config->sobi2Itemid}";
$href = sefRelToAbs($href);
$cancelBt = "<input type='button' class='button' onclick=\"location.href='{$href}'\" id='sobi2CancelButton' name='cancelEdit' value='"._SOBI2_CANCEL."'/>";
$formEnd = $formEnd.$cancelBt;
$formEnd = $formEnd."<input type='submit' id='sobi2SendButton' class='button' value='"._SOBI2_SEND_L."'/>";
$formEnd = $formEnd."\n\t\t\t</td>\n\t\t</tr>";
$this->addToJsValidator(null, 1); // build end section for js validator
return $formEnd;
oraz skrypt java w tym pliku
* start of java script
*/
if($this->jsValidator == null) {
$this->jsValidator = "\n" .
"<script language='javascript' type='text/javascript'>" .
"\n\t function submitEntry() {".
"\n\t\t" .
"\n\t\t var form = document.sobi2EditForm;" .
"document.getElementById('sobi2SlectedCatsID').disa bled = false;" .
"\n\t\t" .
"for(var a = 0; a < document.getElementById('sobi2SlectedCatsID').leng th; ++a) {" .
"\n\t\t\t" .
"document.getElementById('sobi2SlectedCatsID')[a].selected=true;" .
"\n\t\t } " .
"\n\t\t if (document.getElementById('sobi2SlectedCats').lengt h == 0 ) {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_SELECT_CAT."' );" .
"\n\t\t\t return false;" .
"\n\t\t }" .
"\n\t\t else if (form.field_entry_name.value == '') {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_ALL_REQUIRED_FIELDS."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
if($config->needToAcceptEntryRules) {
$this->jsValidator = $this->jsValidator."\n\t\t else if (form.accept_rules.checked == false) {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_ACC_ENTRY_RULES."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
}
if($config->useSecurityCode) {
$this->jsValidator = $this->jsValidator."\n\t\t else if (form.seccode.value == '') {" .
"\n\t\t\t alert( '"._SOBI2_FORM_ENTER_SAFETY_CODE."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
}
}
/*
* end of java script
*/
próbowałem już wielu kombinacji ale nie jestem zbyt mocny z php. Może ktoś mógłby mi pomóc?
if($this->item)
$href = "index.php?option=com_sobi2&sobi2Task=checkin&sobi2 Id={$this->item->id}&Itemid={$config->sobi2Itemid}";
else
$href = "index.php?option=com_sobi2&Itemid={$config->sobi2Itemid}";
$href = sefRelToAbs($href);
$cancelBt = "<input type='button' class='button' onclick=\"location.href='{$href}'\" id='sobi2CancelButton' name='cancelEdit' value='"._SOBI2_CANCEL."'/>";
$formEnd = $formEnd.$cancelBt;
$formEnd = $formEnd."<input type='submit' id='sobi2SendButton' class='button' value='"._SOBI2_SEND_L."'/>";
$formEnd = $formEnd."\n\t\t\t</td>\n\t\t</tr>";
$this->addToJsValidator(null, 1); // build end section for js validator
return $formEnd;
oraz skrypt java w tym pliku
* start of java script
*/
if($this->jsValidator == null) {
$this->jsValidator = "\n" .
"<script language='javascript' type='text/javascript'>" .
"\n\t function submitEntry() {".
"\n\t\t" .
"\n\t\t var form = document.sobi2EditForm;" .
"document.getElementById('sobi2SlectedCatsID').disa bled = false;" .
"\n\t\t" .
"for(var a = 0; a < document.getElementById('sobi2SlectedCatsID').leng th; ++a) {" .
"\n\t\t\t" .
"document.getElementById('sobi2SlectedCatsID')[a].selected=true;" .
"\n\t\t } " .
"\n\t\t if (document.getElementById('sobi2SlectedCats').lengt h == 0 ) {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_SELECT_CAT."' );" .
"\n\t\t\t return false;" .
"\n\t\t }" .
"\n\t\t else if (form.field_entry_name.value == '') {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_ALL_REQUIRED_FIELDS."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
if($config->needToAcceptEntryRules) {
$this->jsValidator = $this->jsValidator."\n\t\t else if (form.accept_rules.checked == false) {" .
"\n\t\t\t alert( '"._SOBI2_FORM_JS_ACC_ENTRY_RULES."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
}
if($config->useSecurityCode) {
$this->jsValidator = $this->jsValidator."\n\t\t else if (form.seccode.value == '') {" .
"\n\t\t\t alert( '"._SOBI2_FORM_ENTER_SAFETY_CODE."' );" .
"\n\t\t\t return false;" .
"\n\t\t }";
}
}
/*
* end of java script
*/
próbowałem już wielu kombinacji ale nie jestem zbyt mocny z php. Może ktoś mógłby mi pomóc?