/*
 * Copyright (c) 2013 LabKey Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.labkey.wnprc_ehr.buttons;

import org.labkey.api.data.TableInfo;
import org.labkey.api.ehr.security.EHRInProgressInsertPermission;
import org.labkey.api.ldk.table.SimpleButtonConfigFactory;
import org.labkey.api.module.Module;

/**
 * User: bimber
 * Date: 8/2/13
 * Time: 12:26 PM
 */
public class WNPRCGoToTaskButton extends SimpleButtonConfigFactory
{
    public WNPRCGoToTaskButton(Module owner, String formType)
    {
        super(owner, "Add Batch of Records", "window.location = LABKEY.ActionURL.buildURL('wnprc_ehr', 'feeding', null, {formtype: '" + formType +"'})");
    }

    public boolean isAvailable(TableInfo ti)
    {
        return super.isAvailable(ti) && ti.hasPermission(ti.getUserSchema().getUser(), EHRInProgressInsertPermission.class);
    }
}


/*
 * Copyright (c) 2013 LabKey Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.labkey.wnprc_ehr.buttons;

import org.labkey.api.data.TableInfo;
import org.labkey.api.ehr.security.EHRInProgressInsertPermission;
import org.labkey.api.ldk.table.SimpleButtonConfigFactory;
import org.labkey.api.module.Module;

/**
 * User: bimber
 * Date: 8/2/13
 * Time: 12:26 PM
 */
public class WNPRCGoToTaskButton extends SimpleButtonConfigFactory
{
    public WNPRCGoToTaskButton(Module owner, String formType)
    {
        super(owner, "Add Batch of Records", "window.location = LABKEY.ActionURL.buildURL('ehr', 'manageTask', null, {formtype: '" + formType +"'})");
    }

    public boolean isAvailable(TableInfo ti)
    {
        return super.isAvailable(ti) && ti.hasPermission(ti.getUserSchema().getUser(), EHRInProgressInsertPermission.class);
    }
}


Revert WNPRCGoToTaskButton to its original (was temporary workaround)